Skip to content
Toolbox

HTML Minifier

Minify HTML by removing comments, collapsing whitespace and trimming attributes. See the exact bytes saved.

Minified code appears here.
Optimisations

About HTML Minifier

Minification strips everything a browser does not need — comments, indentation, line breaks between tags — without changing how the page renders. On a large template this routinely cuts 20 to 40 percent of the transferred bytes, which shows up directly in your Largest Contentful Paint.

How to use it

  1. Paste your HTML.
  2. Choose which optimisations to apply.
  3. Minify, then check the savings summary.
  4. Copy or download the compressed output.

Frequently asked questions

Is minified HTML safe to deploy?

Yes, with one caveat: whitespace inside <pre>, <textarea> and <code> is significant and is preserved here. Everything else collapses safely.

How much will I actually save?

Typically 20 to 40 percent before gzip. After gzip the gain is smaller, since compression already handles repeated whitespace well, but it is still worth doing.

Should I minify by hand?

No. Keep your source readable and minify as a build step. Use this tool for one-off snippets, email templates and pasted markup.

In-depth reads that go beyond the calculator.