HTML Minifier and Beautifier

Shrink or Tidy HTML Code.

Loading…

Minifying strips the comments, line breaks and indentation that browsers ignore, so a page arrives in fewer bytes. Beautifying does the opposite and makes a one-line template readable.

Content inside pre, textarea and script is left exactly as written, CSS inside style blocks is minified too, and spaces between inline elements are kept so words do not run together.

How to use the HTML Minifier and Beautifier tool

  1. Paste the HTML or open a file.
  2. Choose Minify or Beautify.
  3. Copy the HTML or download it as a file.
  • Smaller HTML emails and landing pages
  • Reading the markup of a minified site
  • Cleaning templates before committing them

Tips for the best result

  • Minify a copy and keep the readable source for editing.
  • Server compression (gzip or Brotli) saves far more; minifying adds a little on top.

Quick facts

PriceFree
Works withHTML
Where it runsIn your browser, on your device
AccountNot needed

Frequently asked questions

Can minifying break my page?

It should not. Whitespace that matters, as in pre blocks and between inline tags, is preserved.

Are conditional comments kept?

Yes. Comments that start with [if are left in place.

Does it minify inline JavaScript?

Script blocks are kept unchanged. Use the JavaScript Minifier on them separately.

How much smaller will the file be?

Typically 5 to 20 percent, depending on how much indentation the source has.