HTML Minifier
Paste HTML and get the same markup with the air squeezed out: comments removed, whitespace between tags collapsed, runs of spaces tightened — with the exact size saving shown.
Minify the sample
The sample has a comment and loose spacing — minify it and compare sizes.
A summary of the minification will appear here.
The air, squeezed out safely
Comments and whitespace gone; code contents untouched.
Real minification steps
Comment removal, inter-tag whitespace collapse and space tightening — the safe core of HTML minification.
Code blocks protected
Script, style, pre and textarea contents pass through byte-for-byte; only the markup around them is tightened.
Saving shown as a number
Characters before, characters after and the percentage between them — printed on every run.
About the html minifier
Every kilobyte of HTML is a kilobyte every visitor downloads, and a good share of most pages is air: indentation, blank lines and comments that only the author needed. This minifier removes that air safely — comments stripped (except conditional comments, which old browsers still read), whitespace between tags collapsed, and repeated spaces inside text tightened to one.
The safety is in what it refuses to touch. The contents of script, style, pre and textarea elements are set aside before minifying and restored untouched, because whitespace inside code and preformatted text is meaningful — collapsing it the way markup whitespace collapses would break the page. That is the difference between a careful minifier and a find-and-replace accident.
The result panel reports the size before and after with the percentage saved, so the benefit is a number, not a claim. As with any minification, test the output before it goes live — the tool says so on its own page, because that is the honest workflow.
Frequently asked questions
What is removed, what is protected, and how much you save.
What does HTML minification actually remove?
Comments, the whitespace between tags (indentation and blank lines), and repeated spaces in text. It does not rename anything, restructure the document or touch attribute values.
Is the content of script and style tags safe?
Yes. Script, style, pre and textarea contents are set aside during minification and restored exactly as they were — their whitespace is never collapsed.
Why are conditional comments kept?
Conditional comments (the kind that begin with [if IE]) carry instructions some setups still rely on. Removing them blindly can change how a page renders, so they are always preserved.
How much smaller will my HTML get?
It depends how it was written — hand-indented HTML with comments often shrinks 10–25%; already-tight markup may barely change. The tool shows your exact numbers either way.
Should I minify HTML by hand in production?
For a production site, build-step minification is the norm. This tool suits templates, emails, embeds, quick tests and one-off pages — and you should always test the output before publishing.
Is my code uploaded?
No. The minifier runs entirely in your browser and the code never leaves your device.