HTML Minifier
Strip HTML comments and collapse whitespace between tags to shrink page markup size.
How it works
- 1
Paste your HTML source into the input area.
- 2
Press Minify HTML to strip comments and collapse whitespace.
- 3
Download the result or copy it — no data leaves your browser.
Questions
What exactly gets removed?
HTML comments (except Internet Explorer conditional comments) and redundant whitespace between tags are removed. Content inside <pre>, <textarea>, and <script> elements is kept untouched.
Is this safe to use in production?
It is conservative by design. It does not change attribute values, inline styles, or event handlers, so it is safe for most static pages.
Is my HTML processed on a server?
No. Minification runs locally in your browser and nothing is uploaded.
Why is the saving smaller than I expected?
This is a conservative minifier: it only removes comments and inter-tag whitespace. For larger savings, gzip compression at the server level is far more effective.
More developer tools
JSON Formatter
Paste compact or messy JSON and get it back neatly indented with your chosen spacing.
JSON Minifier
Remove all whitespace and line breaks from a JSON document to shrink it as small as possible.
JSON Validator
Check whether a JSON string is well-formed, and see the exact line and column of any syntax error.
JSON Beautifier
Reformat JSON with sorted keys and readable indentation for easier reading and diffing.
JSON Tree Viewer
Explore a JSON document as an interactive collapsible tree — expand and collapse any node.
XML Formatter
Pretty-print XML with configurable indentation, preserving attributes, comments, and tag order.
XML Validator
Check XML for well-formedness and report every error with its line and column number.
YAML Formatter
Normalize and re-indent YAML, or convert it to JSON, with a configurable indent width.