HTM

HTML Minifier

Shrink HTML by stripping comments and extra whitespace. Free, private and instant.

How to use the HTML Minifier

  1. Paste your HTML into the box.
  2. The minified HTML appears with the size before and after, as you type. Use Copy or Download .txt to save it.

Example

Worked example (run through this tool)

  • Input: A div containing a comment and a paragraph, spread over several lines (51 B)
  • Result: <div><p>Hello world</p></div> (29 B)
  • Trap: <pre>a b</pre> became <pre>a b</pre>: whitespace inside pre is also collapsed

Limitations

  • Whitespace inside <pre>, <textarea> and inline scripts is collapsed too, which can change what they show or do.
  • Conditional comments are kept, but other comments are removed.
  • Attributes and tags are not shortened, so savings are modest.

About this tool

Minify HTML markup by removing comments and collapsing whitespace between tags.

HTML Minifier is part of ToolStack Hub's Developer Tools. It runs entirely in your browser, which keeps your data private and makes results instant. There is nothing to install and no account to create. There is no usage limit.

Frequently asked questions

Is the HTML Minifier free?

Yes. HTML Minifier is completely free with no sign-up, limits or watermarks.

Is my data private when I use the HTML Minifier?

Yes. It runs in your browser, so your input is not uploaded to our servers.

Does it work on mobile?

Yes. ToolStack Hub tools work on phones, tablets and desktop browsers.

Need this automated for your business?

Vantalume builds custom AI and web automation workflows so your team can stop doing repetitive work.

Talk to Vantalume