HTML Minifier

Paste HTML and get it back without the whitespace nobody sees. The counter under the box shows how much you saved.

The code never leaves this page: formatting happens in your browser.

How to use

  1. Paste the HTML into the first box — it is minified as you type.
  2. Check the size figures under the input.
  3. Copy the result, or press «Format» to expand it again.

Good to know

What is removed and what is not

Line breaks between tags, runs of spaces and ordinary comments go. Conditional comments stay, because they carry markup for old browsers. Everything inside pre, textarea, script and style is carried over untouched — a line break there is content, not formatting.

How much this is really worth

On a typical page minification saves ten to twenty percent before compression, and much less after it, because gzip already handles repeated whitespace well. It is worth doing at build time and worth forgetting about during development, where readable markup costs nothing and saves hours.

Frequently asked questions

Will the page still look the same?

Yes, with one caveat: a space between inline elements is visible in the rendered page. Whitespace between tags is collapsed to a single space rather than deleted, so layout does not shift.

Is my code sent anywhere?

No. The whole thing happens on the page, so unreleased templates stay with you.

Does it minify the CSS and JavaScript inside?

No. Those blocks are copied as they are. Use the CSS minifier for stylesheets — mangling script from a markup tool is how subtle bugs get introduced.

Can I undo it?

Press «Format» and the markup is laid out again with indentation. The original line breaks are gone, but the structure comes back.

Related tools