HTML written for people is full of indentation, comments and blank lines that browsers ignore. Removing them reduces page weight, which matters for slow mobile connections, email size limits and pages that are generated or stored many times.
When to use it
- Email templates: keep messages under size limits, like Gmail’s 102 KB clipping point.
- Static pages and landing pages deployed without a build tool.
- Embeds and widgets that are pasted into other sites.
- Performance tuning: see how much of a page is just whitespace.
How to use the HTML Minifier
- Paste HTML or open an .html file.
- Choose whether to minify inline
<script>and<style>blocks and remove comments. - Check the size saving under the result.
- Copy the minified HTML or download it.
Features
- Removes comments (but keeps conditional comments for old email clients).
- Collapses whitespace between tags while keeping one space where inline elements need it.
- Leaves <pre> and <textarea> content exactly as written.
- Minifies inline JavaScript with Terser and inline CSS with CSSO.
- Shows the before and after size.
Frequently asked questions
Can minifying HTML break my page?
Rarely, but whitespace between inline elements (like two links side by side) can matter. This minifier keeps a single space between tags, so text doesn’t run together. Test the result before deploying.
How much does HTML minification save?
Usually 10–20% of the raw file. Gzip or Brotli on the server saves far more, but minification and compression work well together.
Is non-JavaScript script content changed?
No. Scripts with other types, like JSON-LD or templates, are left untouched.
Written by Dewan Razib