HTML Minifier
Remove comments and redundant whitespace from HTML.
Input
This tool runs entirely in your browser. The data you paste or load is never uploaded.
Result
Enter your input, then run the tool.
About this tool
Compacts HTML by collapsing runs of whitespace, trimming between tags and optionally removing comments. Inline <pre>, <textarea> and script blocks are protected so their contents stay untouched.
How to use it
- Paste your HTML template.
- Choose whether comments should be removed.
- Minify and compare the byte counts shown in the result.
Frequently asked questions
Is collapsing whitespace always safe?
Between block tags it is. Inside inline text a single space is kept, and preformatted elements are excluded, which avoids joining words.
Can I keep conditional comments?
Disable comment removal when you rely on legacy conditional comments in the template.
Keep going
Related tools
HTML Formatter
Indent nested HTML and make long templates readable.
CSS Minifier
Shrink stylesheets by removing comments and whitespace.
JavaScript Minifier
Strip comments and blank lines from JavaScript safely.
JSON Formatter
Pretty-print compact or broken JSON with a readable indentation.
JSON Validator
Check JSON syntax and see exactly where it breaks.
JSON Minifier
Strip whitespace from JSON to shrink payloads.