Developer tool

HTML Minifier

Shrink HTML by removing comments and whitespace.

Free Runs in your browser

About this tool

HTML Minifier removes comments and collapses whitespace to make HTML files smaller. Content inside <pre>, <textarea>, <script> and <style> is kept exactly as written.

How to use HTML Minifier

  1. Paste your HTML.
  2. Choose whether to keep comments.
  3. Press “Minify”, then copy or download.

Questions people ask

How much smaller will my HTML be?

Usually 10% to 30% for hand-written HTML. Gzip or Brotli compression on the server saves more, and the two work well together.

Can minifying break a page?

Whitespace between inline elements is collapsed to one space, not removed, so text spacing stays correct. Conditional comments for old IE are kept.

Does it minify inline CSS and JavaScript?

No. Script and style blocks are left untouched to stay safe. Use the CSS and JavaScript minifiers for those.

More developer tools

See all 24 →
Esc