HTML Minifier
Shrink HTML by collapsing whitespace and stripping comments, while leaving pre, textarea, script, and style content untouched.
Processed locally in your browser — nothing is uploaded.
HTML Minifier
0 characters
Minified HTML
Output appears here…About HTML Minifier
A deliberately conservative minifier: whitespace runs collapse to a single space, comments disappear, and everything else stays as you wrote it. Tags, attributes, and quotes are never removed, so the result renders identically to the original.
Content inside pre, textarea, script, and style is copied verbatim, because whitespace there is meaningful. Conditional comments are kept too — they carry logic, not documentation.
Common uses
- Trim an email template before pasting it into a sending platform
- Shrink a static page or fragment that has no build step
- See how much of a page's weight is indentation and comments
Example
Input
<div> <p>Hello world</p> <!-- note --> </div>
Output
<div> <p>Hello world</p> </div>
Limitations
- Whitespace and comments only — attributes, quotes, and optional closing tags are left alone by design
- A single space is kept between elements because removing it can change inline layout
Frequently asked questions
Will minifying my HTML change how the page renders?
No. Whitespace runs collapse to a single space rather than disappearing, because a space between inline elements affects layout, and tags, attributes, and quotes are never removed. The output renders identically to the original.
Is my HTML uploaded to a server for minification?
No. The minifier runs locally in your browser, so unreleased pages, email templates, and markup containing personal data are never transmitted or stored anywhere.
Why isn't the CSS and JavaScript inside my page minified?
Content inside script, style, pre, and textarea is copied verbatim because whitespace there can be meaningful. To compress embedded styles or scripts, run them through the dedicated CSS and JavaScript minifiers and paste the result back.
Does the minifier remove all HTML comments?
Regular comments are removed, but conditional comments like <!--[if IE]> are kept because they carry rendering logic rather than documentation. The byte counter above the output shows exactly how much was saved.
How much smaller does minified HTML actually get?
It depends on how heavily indented and commented the page is — deeply nested, hand-formatted markup often shrinks 10-20%, while already-compact HTML barely changes. Gzip on the server removes most whitespace redundancy anyway, so minification matters most where compression is absent, such as email or inline snippets.