HTML Minifier

Minify HTML safely: remove comments and whitespace while keeping pre, textarea, script and style intact.

What does minifying HTML do?

Minifying HTML removes characters the browser does not need — comments, line breaks and extra spaces — to make the file smaller and faster to download, without changing the page.

What is removed

  • HTML comments (conditional comments for old Internet Explorer are kept).
  • Line breaks, tabs and repeated spaces.
  • Whitespace between tags.
  • Optionally, quotes around simple attribute values (for example class=nav).

What is protected

Content inside <pre>, <textarea>, <script> and <style> is never changed, because whitespace matters there. Minify those separately with the JavaScript Minifier and CSS Minifier.

With gzip or Brotli enabled, minifying HTML usually saves an extra 5–15 %. Check compression with the Gzip & Brotli Checker.

Frequently asked questions

Can minifying break my page?

Rarely. Removing whitespace between inline elements (for example two links side by side) can remove the visual space between them — check the result.

Is minified HTML good for SEO?

Smaller pages load faster, which helps user experience. Search engines read minified HTML the same way.

Does it minify inline CSS and JS?

No, those blocks are kept as they are for safety.