Free tools, no sign-up — everything runs in your browser.
ToolHub 1000Free online tools

HTML Minifier

Strip HTML comments and collapse whitespace between tags.

Quick answer: enter your details below and click Minify HTML — your result appears instantly, right here in your browser. Nothing you enter is uploaded or stored.
H
Developer

Enter your details below.

How to use

  1. Paste your HTML into the box.
  2. Click Minify HTML.
  3. Copy the compact markup.

About this tool

This tool removes HTML comments and the whitespace that sits between a closing angle bracket and the next opening one, then trims the result. Whitespace inside text is left alone, so words in a paragraph are not joined together by accident. It does not touch attribute values or inline scripts and styles beyond the between-tag whitespace, so it is a light cleanup rather than a full production minifier.

Frequently asked questions

Does it remove spaces inside text?

No. Only whitespace between tags is collapsed, so the words inside a paragraph keep their spacing.

Does it remove comments everywhere?

It removes standard HTML comments. Comments inside scripts or styles are left to their own rules and are not specially handled.

Related tools

All tools · Read the guide: HTML Minifier