HTML Minifier

Remove comments from the parsed HTML document tree and normalize tags while retaining text whitespace and embedded code. Get complete HTML output.

Clean comments from an HTML document without an aggressive text-whitespace collapse. The browser parses and serializes the document, so review parser repairs and any added document wrappers.

  • 100% free
  • No registration
  • On your device
  • Modern browser
  1. 1Enter details
  2. 2Adjust options
  3. 3View result

Conservative mode removes comments and normalizes tags while preserving text whitespace and embedded code. Output is a complete HTML document.

ResultLive

Your input stays on this device for this operation. We don’t upload or store it.

About HTML Minifier

Clean comments from an HTML document without an aggressive text-whitespace collapse. The browser parses and serializes the document, so review parser repairs and any added document wrappers.

Comment cleanup

Removes parsed comment nodes.

Document output

Serializes the complete HTML document.

How to use HTML Minifier

  1. 1

    Paste markup or a fragment

    Paste HTML into Source text.

  2. 2

    Remove document comments

    Press Process to remove comment nodes and serialize the document.

  3. 3

    Check the complete document

    Check the resulting head and body before copying.

Formats and practical limits

HTML text or fragment in, complete serialized HTML document out.

  • Fragments can gain html, head and body wrappers. Parser normalization can change malformed markup.
  • The 100,000-unit input limit applies. Embedded scripts and styles remain, and comments inside template content can remain. This operation does not sanitize the output.

Practical example

Paste <p>A<!-- note --> B</p>. The paragraph keeps its text spacing and loses the comment.

Further reading

Frequently Asked Questions

2 answers
Will it minify inline JavaScript?

The tool keeps embedded code. Use a dedicated JavaScript operation if appropriate.

Will the output always be smaller?

Parser-added wrappers can make short snippets longer.