HTML Minifier
Smaller Pages, Identical Rendering
This free HTML minifier works online, strips the comments and spacing out of your markup and hands back a smaller page. First, paste your HTML or drop your files. Then press one button. Finally, copy the result, because the whole job happens in this tab.
- FreePrice
- Not neededAccount
- NoneUploads
- Every runChecked
HTML Minifier
Paste your markup or drop your files — nothing is uploaded
Minified result
- Original
- —
- Minified
- —
- Saved
- —
- Gzipped
- —
- Tags
- —
- Took
- —
Ready. Paste your HTML, then press Minify or Beautify.
What Does an HTML Minifier Actually Do?
An HTML minifier rewrites a page you wrote for people into one a browser downloads faster. It throws away your comments and the indentation that only helps a reader. However, it keeps every tag and every word, so the page renders exactly as it did.
The saving arrives early, which is why it matters. HTML is the first thing a browser asks for and the thing every other request waits behind. Therefore a document that drops from 80 KB to 58 KB starts the whole cascade sooner.
Some people call the same job an HTML compressor. Both words describe one outcome: fewer characters, identical rendering. In short, you ship the small page and you keep the readable one.
Some whitespace matters and most does not. the HTML syntax specification draws that line exactly where this page draws it.
Why HTML Is Harder to Minify Than CSS or JavaScript
In CSS and JavaScript, the space between two tokens is decoration. In HTML it is text that a reader can see. `bold italic` shows a gap between those words and `bolditalic` does not, so a tool that squeezes every space quietly rewrites your sentence.
That single difference explains most "the minifier broke my page" reports. So this tool asks what sits either side of every gap. Beside an inline tag the gap becomes one space, because a reader would see it. Beside a block tag it goes, because nothing renders there.

Parts the Minifier Never Touches
Everything inside `pre`, `textarea`, `script`, `style` and `code` survives byte for byte, newlines included. A space inside a `pre` block is visible output, and a newline inside a script can end a statement.

Conditional comments survive too. `

Why Attribute Quotes Stay
Some tools strip the quotes from `class="card"`. The bytes are real but small, and whether it is safe depends on the value. This tool leaves them, because a handful of characters never justifies that class of bug.
Minify HTML in Four Steps
Zero installs, zero sign-ups, zero queues. Every step happens inside this very browser tab.
- 1
Add your markup
Paste your HTML into the editor, or drop your .html files onto the upload tab. Either route ends in the identical result.
- 2
Choose what goes
Comments go by default, and conditional comments stay. Also, you decide whether to collapse whitespace and tidy attributes.
- 3
Press minify
The tool walks every character, rewrites the page, and then reads its own answer back before showing you anything.
- 4
Copy or download
Copy the smaller markup, or save it as index.min.html. Meanwhile your original stays exactly as you left it.
An HTML Minifier That Respects Your Spaces
A broken page rarely announces itself. It just renders slightly wrong, and nobody spots which tool did it.
It knows inline from block
A gap beside a span or a link becomes one space, because a reader sees it. A gap beside a div goes, because nothing renders there.
Raw blocks stay exact
Whatever sits inside pre, textarea, script, style or code comes out byte for byte, newlines and all.
It verifies every run
The tool re-reads its own output and compares every tag, attribute and word against your original. A mismatch gets reported, never hidden.
Conditionals survive
An IE conditional comment is markup wearing a comment costume. Therefore it stays unless you say otherwise.
Nothing leaves your tab
Your markup never travels anywhere. There is no request, no storage and no log, so client work is safe to paste here.
You see the saving as it truly is
You see the gzipped size beside the raw one, because gzip is what actually reaches your visitor.
Getting the Most From This HTML Compressor
A few small habits keep a minified page predictable.
- Keep the original. Always edit the readable file. So the minified copy stays something you generate, never something you maintain.
- Minify last. Run it after your template engine and after your tests. Otherwise you test one page and ship another.
- Check an inline sentence. Look at one paragraph with links inside it. If the words still have their gaps, the whitespace rules did their job.
- Serve it gzipped. Minifying and compressing stack up. As a result the wire size drops well below what the file looks like on disk.
- Leave conditionals alone. Unless you know nothing depends on them, keep that switch on. They cost almost nothing.
- Watch the verified badge. If a run says it could not verify, do not ship that file. Instead, send us the case and keep your original.
Mistakes That Break a Minified Page
Almost every "it looks wrong now" story is one of these three.
Squeezing inline gaps
A tool that removes every space runs your words together. The page still validates, and it still reads wrong.
Flattening pre blocks
Code samples and ASCII layouts depend on their newlines. Collapse those and the sample becomes one long line.
Editing the minified file
Your changes vanish the next time you build. So the fix always belongs in the source template.
HTML Minifier FAQ
Could this HTML minifier alter the way my page displays?
It should not, and it checks rather than assumes. The tool keeps the spaces that render between inline elements, removes only the ones that render as nothing, and then re-reads its own output to confirm every tag and word survived.
What happens to my script and pre blocks?
They come out byte for byte, newlines included. That matters twice over: a space inside a pre block is visible output, and a newline inside a script can end a statement.
By what percentage will the Denwix minifier shrink my HTML?
Hand-written markup tends to lose 15 to 30 per cent, and Denwix reports the exact saving for your file. However, a page built by a bundler often ships compact already, so it saves far less.
Does it remove my IE conditional comments?
Not unless you ask. Those look like comments but behave like markup, so the tool keeps them by default and gives you a switch when you are certain nothing needs them.
Does the Denwix HTML minifier send my markup anywhere?
No. The whole minifier runs inside your browser tab. There is no request, no storage and no log, so you can safely paste work you cannot share.
Does the Denwix minifier take more than one file per run?
Yes. Open the upload tab and drop as many .html or .htm files as you like. The tool minifies each one separately, and you can download them one by one.
More Denwix Tools Worth Opening Next
Every Denwix tool listed here runs locally, with no login and nothing uploaded.
CSS Minifier
Shrink a stylesheet without breaking calc() or your selectors.
Open tool →JavaScript Minifier
Shrink a script, with the same check that the result still matches your code.
Open tool →Image Size Finder
Read the real dimensions, weight and format of every picture at once.
Open tool →
Shrink your next page in seconds
Paste your markup, press one button, and check the saving for yourself. Nothing travels anywhere and nothing sticks around.