compress

HTML Minifier

Minify HTML by stripping comments and collapsing whitespace while preserving pre, textarea, script, and style blocks. Includes a before-and-after size comparison. Runs entirely client-side.

compress

About HTML Minifier

Removes comments and collapses whitespace while preserving pre, textarea, script, and style blocks. Reverse the operation with theHTML Beautifier, and pair it with CSS Minifier andJS Minifier.

shield_lock

Secure & Private Client-Side

This tool runs entirely in your browser. No data is sent to any server, ensuring your information remains private and secure.

About HTML Minifier

Minify HTML by stripping comments and collapsing whitespace while preserving pre, textarea, script, and style blocks. Includes a before-and-after size comparison. Runs entirely client-side.

Frequently Asked Questions

Are conditional comments preserved? expand_more

Yes. Internet Explorer conditional comments are kept so legacy fallbacks still work.

Is whitespace inside pre and textarea kept? expand_more

Yes. The minifier detects pre, textarea, script, and style blocks and preserves their content exactly.

Can I reverse the minification? expand_more

Yes. Use the [HTML Beautifier](/tools/html-beautifier/) to reformat minified HTML back to readable indentation.

Can I minify CSS and JS too? expand_more

Yes. Use the [CSS Minifier](/tools/css-minifier/) and [JS Minifier](/tools/js-minifier/).

Is my HTML uploaded? expand_more

No. Everything runs locally in your browser.

Common Use Cases

  • Email Templates: Strip comments and whitespace to keep HTML emails compact.
  • Landing Pages: Reduce payload size for performance-critical marketing pages.
  • Static Sites: Minify generated HTML before deploying to a CDN.
  • Embedded Widgets: Shrink embeddable HTML snippets distributed to partners.