Paste HTML to strip comments and extra whitespace for a smaller page, without breaking preformatted text or scripts.

Loading the tool…

What gets removed

What’s kept

Content inside <pre>, <textarea> and <script> is left exactly as written, because whitespace matters there. One space is kept between inline elements, so “<b>Hello</b> <i>world</i>” doesn’t become “Helloworld”.

When to use it

For dynamic sites, let your build tool or caching plugin minify automatically, and make sure the server uses gzip or Brotli compression.

Frequently asked questions

Is it safe to minify HTML?

Yes, with care. This tool keeps whitespace where it matters and leaves scripts untouched.

Why does Gmail clip my email?

Gmail clips messages larger than about 102 KB of HTML. Minifying helps you stay under the limit.

Does minifying HTML help SEO?

Indirectly: smaller pages load faster.

Is my HTML uploaded?

No, it stays in your browser.

Sources

Last updated: