HTML Minifier
Minify HTML by collapsing whitespace and removing comments. Shows the size saved. Free online HTML minifier that runs in your browser.
Input
Result
The result appears here as you type.
What this tool is for
Removes comments and collapses the whitespace between tags. The saving on a single page is modest, but it applies to every request, and unlike CSS or JavaScript the HTML document is never cached as aggressively.
How to use it
- Paste the HTML.
- Choose whether to strip comments and collapse whitespace inside text.
- Compare the sizes and copy the result.
Frequently asked questions
Is whitespace between tags safe to remove?
Mostly, but not always: whitespace between inline elements is rendered as a space, so aggressive collapsing can visually join two links. This tool preserves a single space in those positions.