TOOLTIKI Lovable tool, really free
Developer Formatting

HTML minifier

What to do
Indent

Processed in your browser · nothing is uploaded

Local · inline whitespace collapsed, not removed
Advertisement
320 × 100

Collapses whitespace between tags and removes comments, while leaving pre, textarea, script and style alone and keeping conditional comments.

How to use the html minifier

1 Paste your input. The result appears immediately.
2 Pick the operation you want.
3 Copy the result, or save it as a file.

Whitespace in HTML is not always insignificant, which is why aggressive minifiers cause visual bugs. Between two inline elements a single space is rendered, so removing it runs the words together — `<span>a</span> <span>b</span>` is not the same as `<span>a</span><span>b</span>`. This collapses runs of whitespace and removes it between block-level tags, which is the safe subset. Conditional comments are kept because removing them changes behaviour in old Internet Explorer, and while that scarcely matters now, silently changing semantics is not a minifier’s job.

Questions

Between block elements, yes. Between inline elements a single space is rendered, so this collapses rather than removes it.

MDN — HTML reference
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING