Page Size Analyzer
Weigh a page's HTML and see what is taking up the room.
Compress a stylesheet without touching what it means.
The CSS Minifier removes comments, collapses whitespace, drops the optional semicolon before each closing brace and removes empty rules. It tracks brace depth, because a colon in a declaration and a colon in a selector need opposite treatment — `a :hover` is a descendant selector and `a:hover` is not.
Paste a stylesheet and the minifier removes comments, collapses whitespace, strips the optional semicolon before each closing brace and drops empty rules. Licence comments opening with an exclamation mark are kept, which is the convention for keeping them.
The subtlety is that the same character means different things in different places. A colon inside a declaration block separates a property from its value and the space after it is free; a colon in a selector introduces a pseudo-class, and `a :hover` is a descendant selector while `a:hover` is not. A space inside a media query condition is required. This minifier tracks brace depth so each of those is handled by its own rule rather than by one regular expression that gets it right most of the time.
Brace depth decides how a colon is treated, so pseudo-classes and descendant selectors both survive.
Quoted values and unquoted URLs pass through with only their padding trimmed.
The spaces a media condition requires are kept rather than collapsed away.
A comment opening with an exclamation mark survives, by long-standing convention.
A selector with nothing in it is deleted rather than shipped.
A whole stylesheet or a fragment. It never leaves your browser.
Original and minified sizes, the percentage saved, and a gzipped estimate.
Selectors and media queries are shown intact, so a mangled rule is visible immediately.
Take the minified stylesheet straight into your build or your page.
It should not. Brace depth is tracked, so a colon in a selector and a colon in a declaration are treated differently, and `a :hover` stays a descendant selector. Combinators and media query conditions are handled by their own rules rather than by one blanket pattern.
No, and nothing that only sees the stylesheet could. Finding unused rules needs the pages that use them, and usually needs the pages in a browser, because a class added by JavaScript is not visible in the HTML. That is a build-tool job.
Usually 15 to 30 percent for a hand-written stylesheet with comments and indentation, and much less for one already produced by a build tool. After gzip, the difference between minified and not is smaller than most people expect.
A comment opening with an exclamation mark is preserved, which is the long-standing convention for exactly that. Every other comment is removed.
What people who use the CSS Minifier think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the CSS Minifier. It takes half a minute and no account.
Write the first reviewWeigh a page's HTML and see what is taking up the room.
Build caching headers without guessing what the directives do.
Write image and iframe markup that loads at the right time.
Cluster a keyword list into groups by the words they share.
Find the words and phrases your copy actually leans on.
Expand a seed keyword into hundreds of long-tail variations.
Turn a topic into dozens of workable title options.
Decode tagged links and check the campaign naming holds together.