HTML Minifier
What the HTML Minifier does
The HTML Minifier strips unnecessary whitespace and comments from HTML markup to shrink its file size for production delivery, without altering how the page renders.
How to use it
- Paste your HTML into the box.
- Click Minify HTML.
- Click Copy minified HTML to copy the compressed output.
Common uses
- Reducing page weight before deploying static HTML to production.
- Compressing an HTML email template to fit size limits some email clients enforce.
- Preparing HTML output for a performance benchmark or Lighthouse audit.
- Shrinking HTML snippets before embedding them in a CMS widget.
- Cleaning up excess whitespace left over from a template engine's output.
Good to know
Minifying HTML has a smaller performance impact than minifying CSS or JavaScript in most modern setups, since HTML typically makes up a smaller share of total page weight — it's still worth doing for high-traffic pages, but if you're optimizing load time, compressing images and scripts usually yields bigger wins first.
HTML minification typically yields smaller savings than CSS or JavaScript minification on the same page, simply because markup usually accounts for a smaller share of total page weight compared to styles, scripts, and especially images. It's still worth doing on high-traffic pages where every byte matters at scale, but if you're prioritizing performance work, compressing images and deferring non-critical scripts generally deliver a bigger improvement per hour invested.
Frequently asked questions
This tool only collapses whitespace between tags and removes comments — it doesn't touch script or style content, so inline JS/CSS remains functional.