CSS Minifier

Paste a stylesheet and get a smaller one back: comments, extra whitespace and trailing semicolons come out, safe zeros and colors are shortened, and the before and after sizes are shown. Strings, url() values, calc() spacing and nested @media rules are left exactly as they need to be. It runs in your browser, so your CSS is never uploaded.

Original: 0 bytesMinified: 0 bytesSaved: 0%

Why This Tool Matters

Stylesheets block rendering: a browser will not paint a page until it has downloaded and parsed its CSS, so a few kilobytes of indentation and old comments cost real time on a slow connection. A freelancer pasting a theme override into a CMS box with a size limit needs it to fit. A developer shipping a single-file landing page wants the inline style block as small as it can safely go, and someone auditing a vendor stylesheet wants to know how much of it is just formatting. The size readout answers that straight away.

CSS minifiers go wrong when they treat everything as removable. Spaces matter inside calc(), where 1px + 2px is valid and 1px+2px is not, and they matter between selectors, where a :hover is not the same as a:hover. A path in a url() or text in a content string can contain anything, comments markers included. This tool sets those parts aside before it touches anything, and only shortens a number or color where the result is certain to mean the same thing. For a production build, run your normal minifier as well, since it can also merge rules.

How to Use

  1. 01

    Paste your CSS

    Drop in a whole stylesheet or just a rule. The minified version appears as you type.

  2. 02

    Check the savings

    See the original size, minified size and percentage saved, in bytes.

  3. 03

    Copy the result

    Copy the minified CSS, or use Reset to go back to what you pasted.

More Text Tools

Frequently Asked Questions

What does this CSS minifier change, and what does it leave alone?

It removes comments (except /*! … */ licence comments), collapses whitespace, drops spaces around braces, colons, semicolons, commas and child or sibling combinators, and removes the last semicolon in each rule. In property values it turns 0px into 0, 0.5em into .5em and #aabbcc into #abc. It does not rename anything, merge or reorder rules, remove empty rules, or touch selectors beyond their whitespace.

Will it break calc(), url(), strings or media queries?

Those are the cases it is built to protect. Spaces inside calc(), min(), max() and clamp() are kept, and units inside them are never dropped, because calc(0px + 1px) is valid but calc(0 + 1px) is not. Quoted strings and unquoted url() values are carried through untouched, including any comment markers inside them. Media queries keep the space before each condition, and nested @media rules are handled like any other block.

Why are some zeros and colors not shortened?

Because it only shortens where the meaning cannot change. Zeros are left alone in custom properties (--gap: 0px), in the flex shorthand, and for units such as s, deg and %, where 0 is not always accepted in their place. Hex colors are only shortened in property values, never in selectors like #aabbcc, and values containing legacy progid: filters are skipped entirely.

Can it beautify or un-minify CSS?

No, and that is deliberate. Reformatting CSS reliably means knowing which commas separate selectors and which sit inside values, and getting that wrong changes the code. This page only minifies; use your editor's formatter or a dedicated beautifier to expand a stylesheet.

Is minifying enough, or should I also use gzip?

Use both. Minifying removes characters, while gzip or Brotli compression, which most servers apply automatically, shrinks repeating patterns. They stack, although the benefit of minifying is smaller once compression is on, so check the transfer size rather than just the raw size.

Is my CSS uploaded anywhere?

No. The minifier is JavaScript running in your browser, so a private theme or an unreleased design never leaves your device, and the tool keeps working offline once the page has loaded.