The HTML mode strips comments (except IE conditional comments), then collapses every run of whitespace outside <pre>, <textarea>, <script>, and <style> tags down to a single space and trims the ends — those four tags' contents are carved out first and pasted back untouched, since whitespace inside them can be visible text or syntactically significant code. The CSS mode strips /* */ comments, removes whitespace around { } : ; ,, drops the redundant semicolon before a closing brace, and removes empty rule blocks — while protecting url(...) values and quoted strings from having their internal whitespace collapsed. Byte sizes are measured with the same UTF-8 encoding a real HTTP response uses, not plain character counts, so the savings percentage is accurate for non-ASCII content too. Everything runs in your browser; nothing you paste is sent to a server.
HTML/CSS Minifier
Strip comments and collapse whitespace from HTML or CSS to shrink it before you ship — pre, script, style, and textarea content stays byte-for-byte intact. Runs entirely in your browser; nothing is uploaded.
How this minifier works
Frequently asked questions
Will minifying break my HTML or CSS?
No — this tool only removes what browsers ignore anyway: comments and redundant whitespace. It never touches the content of <pre>, <textarea>, <script>, or <style> tags, so preformatted text, inline JavaScript, and inline CSS survive exactly as typed. CSS string literals and url(...) values are protected the same way, so a space-sensitive value like a data URI or a quoted string is never touched.
Why not just remove all whitespace?
Between two inline elements, whitespace is sometimes the only thing separating two words visually — deleting it entirely could glue "Hello" and "World" together as "HelloWorld". Collapsing runs of whitespace down to a single space is what real minifiers do for exactly this reason: it shrinks the file without changing how the page renders.
Are IE conditional comments removed?
No. Comments that start with <!--[if are left completely untouched, including their internal markup and whitespace, because old Internet Explorer versions parse them as real conditional logic rather than as comments. A generic minifier that strips every HTML comment would silently break any page still shipping IE fallbacks.
Does this run on a server?
No — everything happens in your browser with plain JavaScript. Nothing you paste here is uploaded anywhere, which makes it safe to use on unreleased markup, client work, or anything else you'd rather not send to a third-party service.
How much size does minifying actually save?
It depends entirely on how the source was formatted. Hand-written, heavily indented HTML or CSS with lots of comments can shrink by 20-40%; already-compact output from a build tool might only drop a few percent. The stats line under the output shows the exact before/after byte counts for whatever you pasted.