Paste HTML to strip comments and extra whitespace for a smaller page, without breaking preformatted text or scripts.
Loading the tool…
What gets removed
- HTML comments (IE conditional comments are kept).
- Line breaks, indents and repeated spaces.
- Whitespace around block elements like <div>, <p> and <li>.
- Extra characters in <style> blocks, if you tick that option.
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
- Email templates, where every kilobyte counts (Gmail clips messages over about 102 KB).
- Static pages and landing pages.
- Snippets you embed in other sites.
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: