HTML Minifier
Minify HTML by removing comments and collapsing whitespace between tags while preserving <pre>, <code> and <textarea> content.
—
Minify HTML without breaking your layout
Template engines, build tools and editors all leave a trail: four levels of indentation, leftover development comments, blank lines between blocks. None of it changes what the browser paints, but all of it travels over the wire. Paste your HTML and the minified version appears immediately, with byte counts before and after plus the percentage saved. Content inside pre, code, textarea, script and style is left alone.
There is no HTML parser under the hood, just a chain of regular expressions: protected blocks are masked out, comments are stripped, runs of whitespace collapse to a single space, and whatever sits between two tags disappears. That last step is the one that catches people. Two inline links written on separate lines lose the space between them and render glued together on the page.
Before shipping, check spans, links and buttons that sit side by side in flowing text. Whitespace inside attribute values collapses too, so a multi-line alt or meta content becomes one line. The savings figure is measured before gzip; once compression kicks in, the extra gain from minifying is much smaller than the number suggests. Everything runs in your tab, with nothing sent to a server.
Frequently asked questions
Does it minify inline CSS and JavaScript?
Do IE conditional comments survive?
How much can I actually save?
Related Tools
JS Minifier (basic)
Minify JavaScript by stripping line/block comments and extra whitespace. Works for simple code without full AST parsing.
CSS Minifier
Minify CSS by removing comments, extra whitespace and line breaks. Reduces file size without changing behavior.
HTML Escape / Unescape
Escape special HTML characters (<, >, &, ", ') to HTML entities and convert entities back to text.