jsonecho

HTML Minify

Remove comments and extra whitespace from HTML to make it smaller.

Loading the tool...

How to use HTML Minify

  1. Paste your HTML.
  2. Copy the compact result.

About HTML Minify

Minified HTML loads a bit faster because there are fewer bytes to send. The tool removes comments, collapses whitespace and strips the gaps between tags. Conditional comments for old versions of Internet Explorer are kept.

Content inside <pre>, <textarea> and <script> is left exactly as it is, and CSS inside style tags is minified separately.

Frequently asked questions

How much will I save?

Typically 10 to 30 percent of the HTML size. Gzip or Brotli on the server does much of the same job, so the gain on top of them is smaller.

Can minifying break my page?

Rarely. Whitespace between inline elements, such as two links next to each other, is collapsed rather than removed, so spacing stays the same.

Does it minify JavaScript?

No. Scripts are left alone so nothing gets broken by accident.

More in HTML Tools

All tools →