Developer tools
HTML Minifier
Collapse whitespace and strip comments from HTML — preserves pre/script/style.
393 B
285 B−27.5%
Content inside <pre>, <textarea>, <script>, and <style> is preserved verbatim. Conditional comments (<!--[if IE]>) and SSI directives are also kept.
How it works
- 1Paste an HTML document or fragment.
- 2See the minified output and the byte savings.
- 3Copy and ship — content inside protected tags is untouched.
Use cases
- Pre-minify static templates before publishing.
- Inline HTML in JavaScript without trailing whitespace.
- Reduce the size of email templates.
Frequently asked questions
Is content inside <pre> changed?
No. Pre, textarea, script, and style are extracted and re-inserted verbatim.
Are conditional comments removed?
No. Comments like <!--[if IE]> and SSI directives (<!--#...-->) are kept because they have side effects.
Will it break my page?
For well-formed HTML, no. Hand-written HTML that relies on text-node whitespace for layout (rare today) may render slightly differently.
Read the guide
How to minify HTML safely
The trick to minifying HTML without breaking pages: knowing which tags collapse whitespace and which preserve it. Here's how it works.