HTML Minifier Online
Leaner HTML: comments removed, whitespace collapsed, content untouched.
Content inside <pre> and <textarea> is left exactly as-is, and the single space between inline words and tags is kept so text never runs together.
About this tool
The HTML minifier strips HTML comments (keeping IE conditional comments) and collapses
runs of whitespace to a single space, removing it entirely only around block-level tags where
browsers ignore it. That keeps <b>big</b> <i>world</i> readable
instead of turning it into "bigworld".
<pre> and <textarea> blocks pass through byte-for-byte; inline
<style> and <script> can optionally be compressed too.
How to use
- 1. Paste your HTML.
- 2. Click Minify HTML.
- 3. Copy the leaner markup.
Frequently asked questions
Will it break my layout?
No, whitespace is only removed where browsers ignore it (around block-level tags); between inline elements a single space is kept. pre and textarea content is untouched.
Does it remove conditional comments?
No, IE conditional comments are preserved.
Is it free?
Yes, unlimited, no signup.
Is your website secure? Run the free 7-section scan: vulnerabilities, malware, headers, SEO and speed.
Scan my websiteRelated tools
More from Formatters & Minifiers and Developer.