Skip to content

Minify HTML online

Paste HTML to strip comments and collapse whitespace between tags, and see exactly how many characters you saved.

Minified output
This is a conservative, rule-based minifier: it removes comments and extra whitespace without renaming variables or rewriting code. It is safe for everyday use, but a full bundler (like Terser or esbuild) shrinks production code further.

Your text is processed in your browser as you type. It is not sent to ToolsNest servers or stored after you leave the page.

How to use the HTML Minifier

  1. 1Paste your HTML.
  2. 2Read the minified output and size saving.
  3. 3Copy the result.

Supported formats and limits

  • Removes HTML comments (except IE conditional comments) and whitespace between tags.
  • Does not rename anything or touch inline scripts and styles.
  • Content inside <pre> and <textarea> may be affected — check before shipping.

Common uses

  • Shrinking a hand-written page.
  • Cleaning exported HTML.
  • Learning what minification does.

Frequently asked questions

Is this as good as a build tool?

No — it is a conservative rule-based minifier. Production sites should use a bundler, but this is handy for quick one-off files.

Related tools