HTML Minifier

Paste HTML and get a smaller page.

Free · Runs in your browser · Your text is never uploaded

A large code file shrinking into a small minified file

What changes

Comments are removed and whitespace between block elements is dropped. Spaces between inline elements are collapsed to one so words do not run together. Content of pre and textarea is preserved.

Inline CSS and JS

style and script blocks inside the page are minified as well.

Email templates

Be careful with HTML email: some clients are sensitive to whitespace, so preview before sending.

What minifying changes

The minifier removes comments and collapses extra whitespace between tags. It does not change how the page looks. Gains are usually 5 to 20 percent of the HTML size, so also enable compression (gzip or Brotli) on your server for larger savings.

Safe minifying

Preformatted blocks, textareas and inline scripts need their whitespace preserved. Test the minified page in a browser before publishing, especially if it uses inline JavaScript or conditional comments.

Need more options? Open the full HTML, CSS & JavaScript Minifier.

Related guides

Frequently asked questions

Does it break layouts?

Rarely. Test the page, especially if you use inline-block elements separated by whitespace.

Is conditional comment code kept?

Yes, <!--[if …]--> comments are kept.