Skip to main content

HTML Minifier

Shrink HTML by removing comments and extra whitespace.

What does this tool do?

Direct answerHTML Minifier removes HTML comments and collapses whitespace between tags for smaller documents.
Key factWhitespace between block-level tags is safe to remove; browsers collapse it when rendering anyway.
ProcessingRuns locally in your browser; no data is sent to a server.

How to use

  1. Paste HTML into the input.
  2. Click Minify HTML.
  3. Copy the compressed output.

Example

Input

<div>  <p>  Hello  </p>  <!-- note -->  </div>

Output

<div><p>Hello</p></div>

Who is this for?

This tool was built for people who need a fast answer in the browser — no install, no account, no data leaving the device.

Developers formatting API responses or config files, analysts inspecting minified payloads, and students learning structured data formats. If you have ever squinted at a one-line blob hoping to find a missing brace, this page is for you.

Frequently asked questions

Are conditional comments removed?

Standard comments are removed; content inside <pre> and <textarea> is always preserved.

Will minification break my page?

Inline text keeps single spaces between words; only inter-tag whitespace and comments are removed.

How much smaller will my HTML get?

Typical 15–30% for hand-written HTML; heavily commented files shrink more.

More tools in this category