HTML Minifier
Remove comments and collapse the whitespace browsers ignore — with <pre> and <textarea> content left untouched.
What gets removed
HTML comments (except conditional <!--[if ...]--> ones), line breaks and indentation between tags, and runs of spaces inside text (collapsed to one). Content inside <pre>, <textarea> and <script>/<style> blocks is preserved byte-for-byte, since whitespace matters there.
Frequently asked questions
Can minified HTML change how a page renders?
One edge case: a single space between inline elements (like two links) is significant, so this tool collapses runs of whitespace to one space rather than removing them entirely. That keeps rendering identical.
How much does HTML minification save?
Typically 5–20% raw, less after gzip — compression already handles repetitive whitespace well. It still helps parse time and is worth doing in a build step; this tool covers one-off pages and quick checks.
Last updated: 2026-07-13