What Does the HTML Minifier Do?
The HTML Minifier shrinks web pages by collapsing runs of whitespace, removing the gaps between tags and stripping HTML comments. Content that must keep its exact formatting — everything inside <pre>, <textarea>, <script> and <style> blocks — is automatically protected and passes through unchanged, so your code samples and inline scripts keep working.
Conditional comments for legacy Internet Explorer (<!--[if IE]>) are also preserved, while ordinary comments are removed. The result renders identically but downloads faster, typically saving 10–25% of file size.
How to Minify HTML
- Paste your markup into the left box.
- Choose whether to remove comments and/or collapse whitespace (both on by default).
- Click Minify HTML and check the size report.
- Copy the result or download it as
page.min.html.
Why Minify HTML?
- Faster first paint — HTML is the first thing the browser downloads; a smaller document means parsing starts sooner and improves LCP.
- Email size limits — Gmail clips messages over 102 KB; minifying an HTML email template can keep it under the limit.
- Landing pages and templates — hand-built pages without a build pipeline still deserve production-grade output.
- Bandwidth at scale — a few KB saved per page adds up across thousands of daily visitors.