A typical HTML page carries a hidden tax: indentation spaces, line breaks between tags, and comments that made the file readable to humans but mean nothing to the browser. Stripping them is standard practice before deployment, because every byte between the opening doctype and the closing html tag is downloaded by every visitor. The minifier removes comments and inter-tag whitespace, collapses runs of spaces inside text, and reports exactly how many bytes you saved, live in the output panel.
Paste your HTML and the compacted result appears immediately. The tool runs entirely in your browser, so unreleased pages, client templates, and markup containing private text stay on your machine. There is no signup, no cost, and no file-size gate beyond your device's memory; it works the same on a phone as on a workstation.
What gets removed is deliberate. HTML comments disappear. Whitespace that exists only between tags, where it has no rendering effect, disappears. Runs of spaces inside text collapse to a single space, and leading or trailing whitespace on text nodes is trimmed. Nothing else changes: tags, attributes, attribute values, text content, and the contents of pre, textarea, script, and style blocks are preserved byte for byte.
What the Minifier Removes, Precisely
HTML is forgiving about whitespace, but not uniformly, which is why a careful minifier distinguishes three situations. Whitespace between two block-level tags has no visible effect and can be deleted outright. Whitespace inside flowing text is significant: browsers collapse runs of spaces to one, but one space must remain, and deleting it would glue words together. Whitespace inside pre and textarea is content and must never be touched.
| Situation | Example | Action |
|---|---|---|
| Between block tags | > newline <div> | Removed entirely |
| Inside text runs | fast shipping with double spaces | Collapsed to one space |
| Leading/trailing text whitespace | > Welcome to the store < | Trimmed at the edges |
| Inside pre, textarea, script, style | Indented code sample | Preserved byte for byte |
| Comments | <!-- sidebar starts here --> | Removed entirely |
The edge case worth knowing is the inline-block gap. Two adjacent inline elements separated by whitespace render with a visible space, and that space is sometimes doing layout work, for example between inline-block buttons or list items styled as a horizontal menu. A minifier that deletes inter-tag whitespace indiscriminately would make those elements touch. This tool collapses such whitespace to a single space where it sits between text-bearing inline content, so the rendered spacing survives; pure block-to-block gaps, which render nothing, are removed completely.
How Much Can You Save?
Savings depend on how the source was written. Hand-formatted HTML with generous indentation saves the most; output from a framework that already emits compact markup saves little. Realistic numbers from representative documents:
| Document | Before | After | Saved |
|---|---|---|---|
| Marketing landing page, hand-coded, 2-space indent | 24,600 bytes | 19,300 bytes | 21 percent |
| Blog article page with long prose | 31,000 bytes | 27,400 bytes | 12 percent |
| Framework-rendered page, already compact | 45,200 bytes | 42,100 bytes | 7 percent |
| Email template with heavy indentation | 16,800 bytes | 13,000 bytes | 23 percent |
An honest caveat belongs right next to these numbers: minifying HTML is not a substitute for server compression. Gzip or Brotli, applied by your web server or CDN, typically shrinks HTML by another 70 to 80 percent, and compressed transfer is what actually reaches the visitor's connection. Minification and compression stack, though: removing bytes before compression also removes bytes from the compressed stream, and comment-heavy or deeply indented pages compress measurably worse than clean ones. Think of minification as making the input to compression smaller and more repetitive, not as replacing it.
How to Use the Minifier (Step by Step)
- Paste the HTML you want to compact. Minification runs live, and the byte savings appear alongside the output.
- Skim the result for anything that should have survived: conditional comments or commented-out markup you still need are the usual suspects, since comments are removed.
- Copy the output into your build output, template file, or deployment pipeline.
- Keep the formatted original as your source of truth; minify from it every time you deploy, rather than editing the minified version.
The Deployment Workflow Angle
The healthy pattern is two versions of every template: a readable source file in your repository and a minified artifact at deploy time. Editing minified HTML directly is a mistake you only make once; with comments gone and indentation flattened, a one-character edit is easy to get wrong and hard to review. If you receive minified HTML from someone else, run it through the paired beautifier first, make your changes, and minify again before shipping.
Conditional comments, historically used to serve special markup to old browsers, are parsed as ordinary comments by this tool and will be removed. Modern pages almost never rely on them, but if a legacy template does, check the output for lost blocks. The same scrutiny applies to comments that document template sections; move those notes into the source repository or a separate document before minifying, because they will not survive the pass.
Round Trips and What Minification Does Not Do
Minification is not information-preserving in the strict sense: comments and indentation are gone and cannot be recovered from the output. That is why the readable original matters. The reverse direction, beautifying a minified file, restores structure and line breaks but cannot restore comments that were already stripped, which is a one-way street worth remembering before you delete a source file after minifying it.
The tool also does not do the aggressive tricks that dedicated build-time minifiers perform: it does not rewrite tag names, strip optional closing tags, remove quotes from safe attribute values, or shorten class names. Those transformations save additional bytes but interact subtly with CSS and JavaScript, and they belong behind a tested build pipeline, not a quick browser tool. What this tool removes is the safe, reversible-with-a-beautifier subset: comments and whitespace.
Tips and Best Practices
- Minify from a formatted source file as a build step, never hand-edit minified output.
- Check for inline-block whitespace gaps after minifying; where spacing matters, use CSS to control gaps explicitly instead of relying on source whitespace.
- Combine with server compression for the full win: minification trims the input, gzip or Brotli shrinks the transfer.
- Preserve critical comments by extracting them before minifying, since they will not survive the pass.
- Verify pre-formatted code samples after minification; their whitespace is preserved, but confirm your deployment copies the file, not a reformatted variant.
- Use the byte-savings report to decide whether minification is worth wiring into your pipeline for a given template.