Send feedback

Coming from the page: CSS Minifier

One moment…

Modern CSS supportErrors with line numbersNothing uploaded

CSS Minifier

Shrink your CSS by removing whitespace and comments, while your site looks exactly the same.

Everything runs in your browser: your code and files are never uploaded.

How to minify CSS

1

Paste the code

Paste your CSS or open a .css file, or try “Example”.

2

Minify

Press “Minify” to see the size before and after and the savings.

3

Copy or download

Copy the result or download it as a .min.css file to upload instead of the original.

What changes and what doesn’t

ExampleDetails
RemovedSpaces, line breaks and commentsExcept whitespace that means something, like .a .b and calc(1px + 2px).
Shortened0.50 → .5, #FFFFFF → #fffThe same value in fewer characters.
RemovedEmpty rules .a{} and the last ;They have no effect on the page.
Not changedRule order; no mergingMerging saves a little but can change which rule wins.
Not changedCustom property values --xKept as written, since JavaScript may read them.

Tips

Modern CSS works. Nesting (& .title), @layer, @container and :has() stay intact. Some older minifiers silently drop or break them.

Clear error messages. An unclosed bracket or string? We give you the line and column and take you there.

Source maps. We remove the sourceMappingURL comment, since the old map no longer matches the new file.

Your code stays private: The tool runs entirely in your browser, so your code and files are never sent to any server, and it keeps working offline once the page is open.

FAQ

Does minifying CSS change how my site looks?

No. We never reorder or merge rules and we keep every space that has a meaning. We tested it on 17 real files, including Bootstrap, Bulma, Font Awesome and this site’s own CSS, comparing every rule before and after with an independent CSS parser and with the browser itself: nothing changed.

How much does CSS minification save?

Usually 10% to 40%, depending on whitespace and comments: for example 17% on Bootstrap and 33% on Tachyons. gzip on your server shrinks the transfer further.

Why don’t you merge similar rules?

Merging or moving rules can, in rare cases, change which rule applies to an element, and the extra saving is usually small (1% to 3%). We chose safety.

Are licence comments removed?

No. Comments starting with /*! are kept, because some libraries’ licences require it. You can turn that off.

Which libraries does it use?

The code is read by css-tokenizer from the csstools project (MIT), which follows the W3C spec, and our own code writes the result. We tried csso and clean-css: the first silently drops nested rules, and the second breaks @container and nesting.