1001Ferramentas
🗜️ Dev

HTML Minifier

Minify HTML by removing comments and collapsing whitespace between tags while preserving <pre>, <code> and <textarea> content.

Antes: 0 bytes · Depois: 0 bytes · Economia: 0%

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?
No. script and style blocks are preserved byte for byte, along with pre, code and textarea. Only the surrounding HTML gets compressed.
Do IE conditional comments survive?
No. Comment removal is indiscriminate, so any markup that relies on conditional comments goes with them.
How much can I actually save?
It depends on how indented the file is. Heavily indented HTML usually drops 10% to 20% in raw bytes, and far less than that after gzip, since compression already handles repeated whitespace well.

Related Tools