FOR WEB DEVELOPERS

HTML Minifier

Minify HTML by collapsing whitespace and removing comments, with optional compression of inline CSS and JavaScript. Free and private.

Code stays on your device

1 Your HTML

Processed in your browser. Nothing is uploaded.
THREE SMALL STEPS

How to minify HTML

  1. 01

    Paste your HTML

    Paste a full page or a fragment, up to 1,000,000 characters.

  2. 02

    Choose the options

    Keep or remove comments, and decide whether CSS in style tags and JavaScript in script tags is compressed too.

  3. 03

    Copy the smaller file

    Select “Minify HTML”, check how much smaller it is, then copy the result or download it as an HTML file.

BEFORE YOU START

Good to know

Spaces between words are kept

Runs of whitespace are reduced to a single space instead of being removed, so inline text and buttons stay spaced as before.

Preformatted text is safe

Content inside pre and textarea elements keeps its line breaks and indentation.

Keep your source file

Minified HTML is hard to edit. Keep the original in your project and minify a copy when you publish.

QUESTIONS

Frequently asked questions

Can I minify HTML without changing my original file?

Yes. Paste a copy of the markup, select the options and download the smaller output. Your original file is not overwritten. Test the result in your website before replacing production markup, especially when it contains templates or inline scripts.

Does minifying HTML improve page speed?

It makes the file smaller, which helps most on large pages. Compression by your web server, such as gzip or Brotli, saves more, and both work together.

Why does the HTML minifier show an error?

It stops when it cannot read the markup, for example an attribute with an unclosed quote. The message quotes the part of the code to check.

Is my HTML sent to a server?

No. The minifier runs in your browser, so templates and unpublished pages stay on your device.