HTML Minifier

Minify HTML

Paste HTML to compact it in your browser. This simple tool removes ordinary comments, removes whitespace between tags, collapses other runs of two or more whitespace characters to one, and trims the result. Your text stays on this device.

How to use the HTML Minifier

  1. 1

    Paste HTML

    Paste a snippet or document into the editor.

  2. 2

    Choose the next step

    The page guides you from input to a local result.

  3. 3

    Review and copy

    Check the compacted markup, then copy it if it suits your use case.

What this minifier actually changes

This is a small whitespace-and-comment cleaner, not a full HTML optimizer.

It does

  • Preserve whole <pre>, <code>, and <textarea> blocks.
  • Remove ordinary HTML comments, while keeping comments that begin with <!--[if.
  • Remove whitespace between tags, collapse every other run of two or more whitespace characters to one, and trim the result.

Read the output before using it

The cleaner can change meaningful whitespace in text, <script>, or <style> content. It does not parse HTML semantically, validate markup, protect against security issues, or minify JavaScript and CSS. It has no compression modes and does not remove attributes, tags, or the doctype.

Use it for a quick local cleanup of markup you understand. For production builds, test the resulting page and use a build tool appropriate to your stack.

Frequently Asked Questions

No. The editor processes the HTML in your browser and does not send it through the tool server.

Ordinary HTML comments are removed. Comments beginning with <!--[if are kept.

No. It can alter whitespace inside script, style, or text content, so inspect and test the result.

No. This tool only performs the limited comment and whitespace cleanup described above.

Related Tools

Tool available in other languages