HTML Minifier
Strip comments and collapse whitespace from HTML. See how many bytes you save.
About the HTML Minifier
HTML files often contain significant whitespace from indentation, line breaks, and developer comments. Minifying removes all of this to produce a smaller file that loads faster — especially important for slow connections.
Options
- Strip comments — removes HTML comments. Conditional IE comments are preserved.
- Collapse whitespace — removes whitespace between tags and collapses multiple spaces into one.
- Remove empty attributes — removes attributes with empty string values like
class="".
Frequently Asked Questions
Is it safe to minify HTML?
Yes for most HTML. Be cautious with pre, code, and textarea elements where whitespace is meaningful. This tool does not currently detect and protect those elements.
What does strip comments do?
Removes HTML comments except conditional comments which are preserved as they affect browser behaviour.
How much smaller will my HTML be?
Typically 10–30%. The biggest gains come from collapsing whitespace between tags.