Shrink your HTML — carefully and privately
An HTML Minifier shrinks an HTML file by removing comments and collapsing insignificant whitespace, while keeping it rendering the same. This one runs entirely in your browser — your HTML is never uploaded — and it preserves whitespace-sensitive tags like <pre> and <script>, showing how many bytes you save.
Smaller HTML means faster page loads and less bandwidth. An HTML minifier reduces file size by removing comments and collapsing runs of whitespace (indentation and line breaks between tags) that the browser doesn't need — without changing what the page renders.
Paste your HTML or load a local file, choose your options (remove comments, collapse whitespace, optionally keep conditional comments), and the tool minifies it and shows the size before and after with the percentage saved. Crucially, it preserves the contents of whitespace-sensitive tags — <pre>, <textarea>, <script>, and <style> — and is conservative around inline content, so the visual result stays the same. Copy, download, or flip back to beautify whenever you like.
Privacy is central. Minifying happens in your browser — no server, no upload, no logging, no tracking. You can minify proprietary templates and internal markup without any of it leaving your device, and the tool works offline once loaded.
Now the important honesty. Unlike JSON, HTML whitespace can be significant: the space between inline elements like <a>, <span>, or <img> often affects visible spacing. A minifier that collapses it too aggressively can subtly change your layout. This tool is conservative, but you should still test the minified output on your page before shipping. Also, it's a minifier, not a bundler or deep optimiser — it won't inline assets, aggressively minify embedded JS/CSS, or tree-shake. And for transport, server compression (gzip/brotli) usually saves more than HTML minification alone, though the two stack.
For the reverse, see the HTML Formatter; for stylesheets and scripts, the CSS Minifier and JavaScript Minifier.