HTML Minifier
Shrink HTML by collapsing whitespace and removing comments, without touching pre, textarea, script, style, or conditional comments.
Local workspace
Named projects in IndexedDB · Local only — never synced to our servers. Worksp…
Batch workspace
Format multiple files locally in one run.
Options
| Option | Description |
|---|---|
| Collapse whitespace | Turns runs of spaces, tabs, and line breaks into a single space. |
| Remove comments | Removes HTML comments, apart from conditional comments, which are instructions rather than notes. |
FAQ
Why collapse whitespace instead of removing it?
Because a space between inline elements is rendered. Deleting the space in "a <b>b</b>" would display "ab", which is why aggressive minifiers can subtly change a page. Runs collapse to a single space instead.
What is left untouched?
Everything inside pre, textarea, script, and style, where whitespace is content or code. Attribute quotes stay as they were, and conditional comments are kept.
Why keep conditional comments?
A comment like <!--[if lt IE 9]> is an instruction to old Internet Explorer, not a note. Removing it silently changes what those browsers load, so it survives minification.
Does it minify the CSS and JavaScript inside the page?
No. Inline script and style blocks are copied through byte for byte. Use the CSS Minifier for stylesheets, and a JavaScript bundler for scripts.
How much smaller will my HTML get?
Usually 10 to 20 percent before compression, and much less after it, because gzip and Brotli already compress repeated whitespace well. Minifying still helps pages that ship uncompressed or are embedded in email templates.