Category: Developer tools

HTML Minifier

System ideaMissing a tool?

Remove ordinary comments, drop whitespace between tags, compare byte sizes

Paste HTML and strip ordinary comments and whitespace between tags in your browser. Conditional comments stay. Copy the compact markup and compare UTF-8 byte sizes.

Minified in your browser.

Output
<main><h1>Offline browser tools</h1><p>Everything runs on your device.</p></main>
Original size118 BResult size81 B

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This HTML minifier does a small job well. Paste markup into the input area and it removes ordinary HTML comments, deletes the whitespace sitting between tags, and collapses any run of two or more whitespace characters into one. Conditional comments are deliberately left in place, because dropping them changes how a browser actually treats the markup. The page shows the original and the output size in UTF-8 bytes, gives you a copy action, and adds sample and clear buttons so you can try it on something before pasting your own file. It is just as important to say what this is not. It is not a standards-complete HTML parser and not a build-pipeline optimizer. It does not minify JavaScript or CSS inside your HTML, and it does not rewrite attributes, drop optional tags, remove dead code, validate markup or repair broken markup. Whitespace-sensitive content such as preformatted text may need a review after minifying, since the spacing there is part of what the reader sees. There is no file upload and no batch processing: the input is text you paste. Minification is also not the same as gzip or Brotli, which compress the byte stream in transit, or ZIP, which packs a file. Pasted HTML and the minified output stay in your browser and are never uploaded to LocalTools.

How to use it

  1. Paste your HTML into the input area, or load the sample to see what changes.
  2. Ordinary comments go, whitespace between tags is removed and repeated whitespace collapses; conditional comments stay.
  3. Compare the original and output byte sizes, copy the compact markup, then review any preformatted text.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

How do I minify HTML online?
Paste the markup into the input area. The tool removes ordinary comments and the whitespace between tags, collapses repeated whitespace, and hands you compact HTML to copy. No account, no upload, no install.
Will minifying HTML affect the functionality of my website?
The changes are limited to ordinary comments and insignificant whitespace, so behaviour normally stays the same. Conditional comments are preserved on purpose. The tool does not validate or repair markup, so broken HTML stays broken.
Is HTML minification safe around pre and textarea?
Treat that content as needing review. Whitespace inside preformatted text is visible output, and collapsing it can change what a reader sees. This tool applies the same whitespace rules everywhere, so check those blocks yourself before shipping.
What's the difference between minifying HTML, CSS, and JavaScript?
They are separate jobs with separate rules. This tool handles HTML comments and whitespace only. It does not minify CSS or JavaScript inside your HTML, and it is not a replacement for a build-pipeline optimizer.
Is minification the same as compression?
No. Minifying deletes characters from the source text; gzip and Brotli compress the byte stream on the way to the browser, and ZIP packages a file. This tool only does the first, and you can see the result as a UTF-8 byte comparison.