HTML Minifier
Strips HTML comments and collapses whitespace to reduce file size. Shows before/after byte counts and savings percentage. Note: whitespace-only minification — does not parse or minify inline script or style blocks. Runs in your browser.
Minify HTML text in the browser by removing ordinary HTML comments, collapsing whitespace between tags, reducing repeated whitespace, and trimming the result.
How to minify HTML
- Paste HTML into the input area.
- Review the automatically updated minified result or press Minify.
- Check the before/after byte counts and copy the output.
How this minifier works
Ordinary HTML comments are removed, but IE-style conditional comments beginning with <!--[if are preserved.
This is regex-based whitespace reduction, not a full HTML parser, so whitespace-sensitive content such as preformatted text can change.
Privacy and limitations
The HTML is processed locally in your browser. Because the tool uses simple text replacements rather than a full parser, always verify output when whitespace is meaningful inside text, pre, textarea, script, style, or template content.
HTML Minifier FAQ
Does it remove comments?
Yes, except IE-style conditional comments beginning with <!--[if.
Does it validate HTML?
No. It does not parse or repair invalid markup.
Can it change visible text spacing?
Yes. Repeated whitespace can be collapsed, so whitespace-sensitive markup needs review.
Does it show size savings?
Yes. It compares UTF-8 byte counts before and after.
Is the HTML uploaded?
No. Processing happens in the browser.