Support
Dev Tools / Minify HTML Code

Browse by category

All categories

Minify HTML Code

Minify HTML by removing whitespace, comments, and optional tags to reduce page size. Paste production code, API keys, tokens.

1
Paste HTML
Paste your HTML code into the input area
2
Minify
The HTML is minified with whitespace and comment removal
3
Copy result
Copy the minified HTML or download as a file

HTML Input

Minified HTML

Minified HTML will appear here...
  • Content inside <pre>, <code>, and <textarea> survives the whitespace pass.
  • Conditional IE comments (<!--[if IE]>) are kept even when "Remove comments" is on.
  • Enable Preserve template syntax when minifying server-rendered templates so {{ var }}, <?= ... ?>, and {% block %} survive intact.

Frequently Asked Questions

What is removed during minification?

Unnecessary whitespace, HTML comments, optional closing tags, and redundant attributes.

Does it also minify inline CSS and JS?

Yes. Inline CSS and JavaScript within the HTML are also minified.

Is it safe to paste production data?

Yes. Minification runs locally. Templates with embedded API keys, internal endpoints, or credentials in comments stay on your machine.

This tool is free thanks to our sponsors. Support Loft Tools