CSS Minifier

Minify & optimise CSS with rule restructuring.

Minify CSS online: strip comments and whitespace and, optionally, restructure rules — merging duplicate selectors and reordering declarations — with the csso optimiser. URLs, strings, variables and @media are parsed safely. Runs fully in your browser — nothing is uploaded.

How to use CSS Minifier

  1. Paste your CSS

    Paste your CSS or upload a .css file into this free online CSS minifier to compress the stylesheet instantly in your browser, with nothing uploaded.

  2. Restructure rules

    Keep Restructure rules on so the optimiser merges duplicate selectors, drops overridden declarations and reorders rules for maximum CSS compression.

  3. Keep banner comments

    Enable Keep comments to preserve licence and banner blocks written as special comments while every other comment is safely stripped from the CSS.

  4. Merge media queries

    Turn on Merge media queries to combine identical media blocks, squeezing extra bytes out of responsive stylesheets without changing the cascade.

  5. See the savings

    The minified CSS appears instantly with a stats strip showing the byte savings and the gzipped size that the browser actually downloads.

  6. Copy or download

    Copy the minified CSS to your clipboard with one click or download it as a ready-to-deploy .css file straight from your browser.

Frequently asked questions

Is minified CSS still valid?

Yes. Minification only removes characters that don't change meaning — whitespace, comments and redundant punctuation — and, when restructuring is on, safely merges and reorders rules. The cascade and final rendering stay exactly the same.

What does “Restructure rules” actually do?

It runs csso's structural optimiser: merging selectors with identical declarations, removing declarations that are later overridden, shortening values and reordering rules where it's safe. Turn it off if you want a pure whitespace/comment strip that keeps your source order intact.

Why is the gzipped size so much smaller?

CSS is highly repetitive, so gzip compresses it very well on top of minification. The gzipped figure in the stats strip is the number that matters most — it's roughly what the browser actually downloads when your server sends the file gzip-encoded.

Will it break my CSS variables or @media queries?

No. Custom properties (--brand), var(), @media, @supports, calc() and keyframes are all understood by the parser and preserved. “Merge @media queries” only combines blocks that target the exact same condition.

How do I minify CSS online for free?

Paste your CSS or upload a .css file and the minifier instantly strips comments, whitespace and redundant punctuation, then lets you copy or download the minified.css. It's a free online CSS minifier with no sign-up and no upload — everything runs in your browser.

How much can minifying CSS reduce file size and speed up my site?

Minifying CSS typically cuts 20–50% of the raw bytes, and with restructuring plus gzip the download can shrink even further. Smaller stylesheets load faster, which improves page speed and Core Web Vitals scores.

Is anything sent to a server?

No. The CSS is parsed and minified entirely in your browser — nothing is uploaded, logged or stored.

Can I un-minify or beautify CSS again?

Minifying is one-way — it strips the formatting rather than storing it — so keep your original source for editing. To make minified CSS readable again, run it through a CSS beautifier/formatter, which re-adds indentation and line breaks (though removed comments can't be recovered).

Is it safe to minify CSS with vendor prefixes and animations?

Yes. The csso-based parser understands vendor-prefixed properties (-webkit-, -moz-), @keyframes animations, calc(), gradients and media queries, and preserves them exactly — it only removes characters that don't affect how the styles render.

Related tools — Minifiers