Skip to content

HTML Minifier

Shrink HTML pages and email templates without breaking them.

0 BOriginal size
0 BMinified size
0%Saved

Paste HTML or open a .html file and this minifier makes it smaller: runs of spaces and line breaks are collapsed, whitespace around block elements such as div, p and li is removed, and comments can be stripped. Inline <style> blocks can be minified too.

It is deliberately conservative. The contents of <pre>, <textarea> and <script> are left exactly as they are, single spaces between inline elements are kept, and Internet Explorer conditional comments survive, so the page looks the same after minifying.

How to use the HTML Minifier tool

  1. Paste HTML or open a .html file.
  2. Choose whether to remove comments and minify inline CSS.
  3. Check the sizes and the percentage saved.
  4. Copy the result or download it.

Why use ToolOrca HTML Minifier

  • Collapses whitespace safely
  • Removes comments (optional)
  • Minifies inline style blocks (optional)
  • Leaves pre, textarea and script untouched
  • Shows bytes and percentage saved
  • Runs in your browser

What a safe HTML minifier changes

Browsers treat a run of spaces and line breaks in normal text as one space, so collapsing them does not change how the page looks. Around block-level tags, that space is not displayed at all and can be removed completely.

Inline elements are different: in <b>Hello</b> <i>world</i> the space between them is visible, so it is kept. Inside <pre> and <textarea> every space matters, and JavaScript is best minified with a dedicated build tool, so those are left alone.

Frequently asked questions

Will this break my page?

It is designed not to: it only removes whitespace browsers ignore and comments. Always test the minified page, especially if it relies on whitespace in CSS with white-space: pre.

Does it minify JavaScript?

No. Script contents are only trimmed. Use a build tool such as esbuild or Terser for JavaScript.

Can I minify email templates?

Yes. Keep comments if your template uses conditional comments for Outlook; those starting with <!--[if are always kept.

Is my code uploaded?

No, minifying happens in your browser.