About the HTML Minifier
The HTML Minifier runs entirely in your browser — your data never leaves your machine. Paste, click and copy the result.
Every byte of markup is downloaded on every visit. This minifier strips comments, joins tags that sit on their own lines and collapses runs of spaces, while carefully protecting the content of pre, textarea, script and style blocks, where whitespace actually matters.
How to use this tool
- Paste your HTML into the input.
- Leave the comments option on to strip HTML comments.
- Click Minify HTML and copy the compressed markup.
What is preserved
- All tags, attributes and text content.
- Whitespace inside
pre,textarea,scriptandstyle. - Conditional comments used for legacy browsers.
Developer tip
Because HTML collapses runs of ordinary whitespace to a single space anyway, minifying it is almost always safe. Still, diff the output against your source before shipping to catch anything unusual.
Who is this tool for?
Developers optimising page weight and anyone embedding HTML email or templates where every character counts.