Minify HTML code instantly

Remove comments, collapse whitespace, and reduce file size. Preserves content inside <pre>, <code>, and <textarea> tags. All processing happens in your browser.

100% Private Processed locally Free & unlimited

HTML Minifier

Paste any HTML code to remove comments, collapse whitespace, and reduce file size.

Mode:

No HTML minified yet

Paste your HTML code above and click Minify to see savings, compression ratio, and the minified result.

0%
Savings
Compression Stats
Original
0
Minified
0
Savings
0%
Saved
0
Processing Report
HTML
0 B0 B
0%
CSS
0 B0 B
0%
JS
0 B0 B
0%
Comments
0 removed
Whitespace
0 chars
Time
0 ms
Status
✓ Valid
Compare with Previous
Recent Activity

What this tool does not do

  • Does not reformat or beautify HTML — it only removes comments and whitespace.
  • Does not remove or alter attributes, class names, or IDs.
  • Results are based on basic minification, not AST-based optimization.

How It Works

1

Paste your HTML

Enter or paste any HTML code into the input area.

2

Click Minify

Remove comments, whitespace, and unnecessary line breaks instantly.

3

Copy the result

Export the minified code or save it as a file for production.

Frequently Asked Questions

What does the HTML minifier do?

It removes HTML comments, collapses multiple spaces into one, removes unnecessary line breaks, and preserves content inside pre, code, and textarea tags.

Does it preserve pre and code tags?

Yes. The minifier preserves the whitespace and formatting inside pre, code, and textarea elements to avoid breaking code examples or formatted text.

Is my HTML uploaded to a server?

No. All processing happens entirely in your browser. Your code never leaves your device.

Read Guide: How to Minify HTML ➔