H↓HTML Minifier
Strip comments and whitespace from HTML to shrink file size.
Unlike CSS, whitespace in HTML is sometimes real content, and this is the thing that makes HTML minification riskier than it looks.
The space between two inline elements — between a link and the word after it, between two spans — renders. Collapse it carelessly and you get text that runs together. Aggressive minifiers produce this bug regularly, and it survives review because nobody rereads the body copy after a build change.
Inside pre and textarea elements, whitespace is entirely significant and has to survive untouched.
Where it is genuinely worth doing
Email templates. Gmail clips messages past roughly 102KB and hides the rest behind a link, which will happily cut your unsubscribe footer off. Email HTML is verbose by necessity — tables, inline styles on everything — so it is one of the few places where stripping whitespace changes an outcome rather than a metric.
Static pages and generated fragments, if you are counting bytes for a specific reason.
Where it is not
A WordPress site. Pages are generated fresh on every request, so pasting page source into a browser tool is a one-time operation on output that will be regenerated the moment you edit anything. Use a caching plugin that minifies automatically, or leave it.
And HTML compresses extremely well already. Repetitive tags are the ideal case for gzip, which means the savings from minifying on top of compression are usually smaller than the effort.
If you do minify an email template
Send yourself a test in the clients you actually care about, not the editor preview. Conditional comments for Outlook look like comments and are functional — a minifier that strips comments will remove them, and the layout will collapse in the one client you were accommodating.
This tool is provided free of charge for general information and convenience only. It runs in your browser and we do not store the data you enter. We make no guarantee as to the accuracy, completeness, or suitability of any result, and accept no liability for any loss, damage, or decision arising from its use — use it at your own risk. See our Terms & Conditions.