HTML Minifier

Minify HTML online for free. Collapse whitespace, strip comments and shrink markup to load faster — instant, private, and fully in your browser.

Collapses whitespace and removes the gaps between tags. The contents of pre, textarea, script and style tags are preserved exactly.

Frequently asked questions

How does minifying HTML reduce file size?
It collapses runs of whitespace to a single space, removes the gaps between tags and optionally strips comments. The page renders identically but transfers fewer bytes, so it loads faster.
Will minifying break my page, pre blocks or scripts?
No. The contents of pre, textarea, script and style tags are preserved exactly, so formatted code, inline JavaScript and CSS keep their original spacing.
Are conditional comments removed?
No. Conditional comments like <!--[if IE]> are kept because they affect rendering. Only ordinary comments are removed, and only when you leave the option on.
Is my HTML uploaded anywhere?
No. Minifying runs entirely in your browser — your markup never leaves your device.