HTML Minifier

Shrink HTML by collapsing whitespace and stripping comments. Options stay conservative: attribute quotes are kept, and embedded scripts are not aggressively rewritten.

Result

Paste code, then Minify. Libraries load in your browser.

How to minify HTML

  1. Paste HTML.
  2. Click Minify (the minifier library loads on first use).
  3. Whitespace and comments are collapsed; attribute quotes are kept.
  4. Copy the compressed markup as text — it is not rendered on the page.

FAQ

Attribute-quote removal, script/style type-attribute stripping, and embedded JS minify are off so markup stays safer to round-trip.
Comment removal is on. Conditional comments and IE leftovers are not preserved in this MVP.
No. html-minifier-terser runs locally in your browser.
Conservative options keep quotes and most attribute values intact. Review output if you rely on whitespace-sensitive pre blocks or unusual template placeholders.
No. Embedded script minification is disabled in this MVP so markup round-trips more safely. Minify scripts separately with the JavaScript Minifier if needed.

Related tools