HTML minifier
Processed in your browser · nothing is uploaded
Removes the whitespace between tags outright, collapses runs of it inside text to a single space, and drops ordinary comments: leaving pre, textarea, script, style and conditional comments untouched.
How to use the html minifier
Being precise about what happens matters here, because two different things happen. Whitespace sitting between a closing tag and the next opening tag is removed entirely, not reduced. Whitespace inside text is collapsed instead: two or more spaces become one, and a single space survives.
That first rule is free between block-level elements and is not free between inline ones. <span>a</span> <span>b</span> renders with a space between the words; <span>a</span><span>b</span> does not. The same applies when the separator is a line break rather than a space, which is the usual case in hand-written markup, so after minifying, check any pair of inline elements that sat on separate lines. That is the one place this can change what a page looks like.
Conditional comments are kept because removing them changes behaviour in old Internet Explorer, and while that scarcely matters now, silently changing semantics is not a minifier’s job. Nothing else is rewritten: attribute quotes stay, optional closing tags stay, and no attribute is reordered. Some minifiers do all three; each is another way to be surprised.
On size, expect 10 to 20 percent before compression and considerably less after it, since gzip is already very good at repeated whitespace. Inline <script> and <style> blocks are preserved whole rather than minified: the CSS minifier is the tool for stylesheets.
Questions
Between block elements, yes. Between two inline elements it is not, that space is rendered, and removing it joins the words. Check any inline pair that sat on separate lines.
Ordinary ones yes, conditional ones no; removing those changes behaviour.
pre, textarea, script and style, byte for byte, plus conditional comments, attribute quoting and every optional closing tag.
Typically 10 to 20 percent, though gzip already handles repeated whitespace well.
No, those blocks are preserved intact. Use the CSS minifier for stylesheets.
No.