← DevHelpers|HTML Minifier

HTML Minifier — Conservative Markup Cleanup

Remove ordinary comments and compact markup while keeping text whitespace, preformatted content and inline scripts intact. Processing runs locally; copy or download the result after reviewing it.

Removes ordinary comments and compacts tag formatting. Keeps all text whitespace, preformatted content, conditional comments and inline scripts/styles. Savings can be small.

Processing stays in your browser. Open a text file up to 2 MB or paste a snippet.

Editing the input or options clears the previous result.

Keep meaningful whitespace

The HTML parser preserves text nodes, including spaces between inline elements and content inside pre, textarea, script and style elements. It does not collapse text whitespace or minify embedded CSS and JavaScript.

Understand the size difference

Savings come mainly from ordinary comment removal and compact attribute serialization. Already compact files may barely shrink or grow during serialization. Conditional comments and recognized framework comment markers are retained; review any template-specific markers in your output.

Frequently asked questions

What does this HTML minifier remove?⌄

It removes ordinary comments and reprints markup. It preserves text whitespace and does not optimize inline CSS or JavaScript.

Why is the output not much smaller?⌄

Conservative cleanup deliberately keeps whitespace that your styles or scripts may depend on. Comment-free HTML may not shrink.

Is my HTML uploaded?⌄

No. The parser runs in a browser worker and does not execute your markup.

Related tools & guides