HTML Minifier
Minify HTML to speed up pages — preserves pre, script & style blocks.
How it works
Shrink HTML by removing comments and unnecessary whitespace, making pages load faster. Content inside <pre>, <textarea>, <script> and <style> is preserved so nothing breaks.
Try an example
—🔒 Generated entirely in your browser — nothing is uploaded.
🔒 Runs in your browser: tags, sitemaps and minification are generated locally from what you type — nothing is uploaded, no signup, no limits.
About the HTML Minifier
This free HTML minifier shrinks your markup by removing comments and collapsing unnecessary whitespace, so pages download and render faster. It's deliberately conservative — the contents of pre, textarea, script and style tags are preserved exactly, so minifying never breaks your page or code samples.
Everything runs in your browser; your HTML is never uploaded.
What it does
- Removes HTML comments (keeping IE conditional comments).
- Collapses runs of whitespace and removes it between tags.
- Preserves whitespace-sensitive content inside pre, textarea, script and style.
Frequently asked questions
Will minifying break my page?
This minifier is conservative by design: it leaves the contents of pre, textarea, script and style untouched and keeps single spaces between inline elements, so layout and code samples are preserved.
How much smaller will my HTML get?
It depends on how much whitespace and how many comments the file has — typically a modest but worthwhile reduction. The tool shows the before and after size and the percentage saved.
Should I minify the inline CSS and JavaScript too?
This tool preserves script and style contents. To minify those, paste them into the dedicated CSS Minifier and JavaScript Minifier.
Is my HTML uploaded?
No. Minification happens entirely in your browser.