đŸ“Ļ

HTML Minifier

Strip comments and collapse whitespace to shrink HTML.

🔒 Runs entirely in your browser — nothing is uploaded.

â„šī¸ Basic whitespace/comment minifier. Avoid using it on markup where whitespace is significant (inside <pre>, <textarea>, or inline scripts).

How HTML Minifier works

How does the HTML minifier work?

It strips <!-- --> comments, collapses whitespace directly between tags (> < becomes ><), and squeezes tabs, newlines, and repeated spaces down to single spaces - all through regex replacements rather than a real HTML parser.

When would I minify HTML?

It is useful for trimming a static page or email template before shipping it, cutting out formatting whitespace that a browser render would not miss anyway.

Is it safe to run on any HTML?

Not always - the page itself warns that it is a basic whitespace/comment minifier, so it can misbehave on markup where whitespace is meaningful, such as inside <pre>, <textarea>, or inline scripts containing template literals. Check those sections manually after minifying.