HTML Minifier

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

Runs in your browserNothing uploadedFree · no signup

Collapses whitespace and removes it wherever the browser would not render it — beside block elements like div and p — but keeps a single space between inline tags such as span, a and b, where it is a visible word gap. The contents of pre, textarea, script and style tags are preserved exactly. Going the other way? Use the HTML Beautifier.

Frequently asked questions

How does minifying HTML reduce file size?
It collapses runs of whitespace to a single space, removes whitespace beside block elements such as div, p and li (where the browser would not show it) and optionally strips comments. The single space between two inline tags, like </strong> <em>, is kept because it is a visible word gap. The page renders identically but transfers fewer bytes.
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.