HTML Minifier

Shrink HTML pages and email templates by removing comments and extra whitespace, safely.

🔒 Runs in your browser. Nothing you enter is uploaded.

How to use the HTML Minifier

  1. Paste your HTML
  2. Choose whether to keep comments
  3. Copy the minified HTML and check the bytes saved

About this tool

Minification removes characters browsers do not need, such as indentation, line breaks and comments, so pages download faster. The minifier collapses whitespace between tags, removes it around block elements like <div> and <p>, and leaves <pre>, <textarea> and <script> content alone, where whitespace can matter. Conditional comments (<!--[if IE]>) are kept. CSS inside <style> tags is minified as well.

Most hosts, including Cloudflare, also gzip or Brotli-compress responses. Minification still helps, because the two savings add up.

Frequently asked questions

Can minifying break my page?

Rarely. A single space is kept between inline elements, so “a b” still has its space. Test the result before you deploy it.

Does it minify inline JavaScript?

No. Script blocks are left unchanged to be safe. Run them through the JavaScript minifier separately.

How much will I save?

Typically 10–25% for hand-written HTML, and more for heavily indented templates.

Related tools

Updated · Built and maintained by the UtilityBright team · About our tools · Report a problem