Skip to main content

HTML Minifier

Minify HTML by removing whitespace, comments, and optional tags.

minifycompresshtml
Read the guide
Shortcuts:⌘ KSearch
Lines: 0Characters: 0

Frequently Asked Questions

What does this minifier actually remove?

It strips HTML comments, removes whitespace between tags, normalizes repeated spaces, tightens spaces around quoted attributes, and drops closing tags for `li`, `td`, `th`, `tr`, and `option`.

Does it validate my HTML before minifying it?

No. Like the formatter half of this component, it transforms text with simple rules rather than running a real HTML parser or validator.

Why did my `<pre>` or spacing-sensitive content change?

The minifier does not have a special preservation path for preformatted text. Since it globally normalizes whitespace, spacing-sensitive sections should be checked carefully afterward.

Can I pretty-print from the same interface too?

Yes. This page uses the same shared component as the formatter, so both Format and Minify actions are available.

What do the stats badges measure?

They show the line count and character count of the output textarea. That's useful for quickly seeing how compact the minified HTML became.

Related Tools