Developer Tools

HTML Minifier

Shrink HTML by removing comments and unnecessary whitespace.

—Original
—Minified
—Saved

What does an HTML minifier do?

When people write HTML they use indentation, line breaks and comments to keep the code readable. Browsers do not need any of that. Minifying removes it, so the file that visitors download is smaller and the page starts showing a little sooner. On large pages, minification often saves 10 to 25 percent of the HTML size, and even more when combined with server compression such as Gzip or Brotli.

How to minify HTML

  1. Paste your HTML into the box.
  2. Choose whether to remove comments and the whitespace between tags.
  3. Click Minify HTML and check the size saved.
  4. Copy the result and keep your original, readable file for future editing.

What is removed, and what is kept

A note about spaces between inline elements

Removing all space between tags can join words that were separated only by a line break, for example two links written on separate lines, or a <strong> word next to normal text. If words run together after minifying, untick Remove whitespace between tags. A single space is then kept, which looks the same as the original.

Frequently asked questions

Can minifying break my page?

The content of scripts, styles and preformatted text is protected, so the page normally looks identical. Always test the minified version before uploading.

Should I also minify CSS and JavaScript?

Yes. Use the CSS Minifier and JS Minifier for the separate files.

Does minification help SEO?

Indirectly. Faster pages give a better experience, and page speed is one of many signals search engines consider.