HTML Minifier

Remove comments and redundant whitespace from HTML.

Runs in your browser Developer Tools Free · No account

Input

Processed locally

This tool runs entirely in your browser. The data you paste or load is never uploaded.

Result

Enter your input, then run the tool.

About this tool

Compacts HTML by collapsing runs of whitespace, trimming between tags and optionally removing comments. Inline <pre>, <textarea> and script blocks are protected so their contents stay untouched.

How to use it

  1. Paste your HTML template.
  2. Choose whether comments should be removed.
  3. Minify and compare the byte counts shown in the result.

Frequently asked questions

Is collapsing whitespace always safe?
Between block tags it is. Inside inline text a single space is kept, and preformatted elements are excluded, which avoids joining words.
Can I keep conditional comments?
Disable comment removal when you rely on legacy conditional comments in the template.

Keep going

More in this category