Paste your HTML below and get a minified version instantly. Whitespace, comments, and redundant attributes are removed client-side — your code never leaves your browser.
HTML minification reduces the size of your HTML documents by removing everything the browser doesn't need to render the page: whitespace between tags, HTML comments, optional closing tags (like </li> or </td>), redundant attribute quotes, and default attribute values. The resulting document is functionally identical but significantly smaller — often 10–30% for typical pages, and more for document-heavy templates.
Unlike CSS or JS minification, HTML minification requires care around whitespace-sensitive elements (like <pre>, <textarea>, and inline elements) where collapsing whitespace would change visual output. This tool handles those cases safely by only collapsing inter-element whitespace, not content whitespace inside inline or pre-formatted elements.
.min.html
<!-- … -->)
</li>, </td>, etc.)
style="" attribute whitespace and comments
Yes — and they complement each other well. Gzip (and the more modern Brotli) compress data at the network level by finding repeated byte sequences. HTML documents contain a lot of repetition in tag names, attributes, and common strings, so gzip achieves impressive compression ratios (often 70–80%) regardless of whether the HTML was pre-minified.
However, minifying HTML before compression still helps in two ways: it makes gzip's job slightly easier by removing unique noise (comments, erratic whitespace) that would otherwise dilute pattern matching, and it reduces the amount of data the server must read and compress on every request. More importantly, minified HTML is served faster from browser caches — because the cache stores the already-decompressed response, and a minified response is smaller even after decompression. For high-traffic pages, both minification and compression are standard practice.