CSS Minifier

Minify CSS online to cut file size and speed up your site — free CSS minifier and compressor.

About

About the CSS Minifier

Paste CSS and get it minified using csso, a structural minifier that understands the actual rule syntax — merging duplicate selectors and shortening values like turning margin: 0px 0px 10px 0px into margin:0 0 10px, rather than just stripping whitespace and comments.

csso does more than strip whitespace: it shortens colours like #ffffff to #fff, drops units from zero values, removes rules that end up empty and merges selectors whose declarations are identical. Comments are removed, except ones that start with /*!, which is the usual way to keep a licence header.

Choose what to view about this tool

Guide

Using the CSS Minifier

  1. 1

    Step 1

    CSS is already selected below as the language.

  2. 2

    Step 2

    Paste your CSS code into the input box.

  3. 3

    Step 3

    Click Minify to see the compressed output, entirely in your browser.

  4. 4

    Step 4

    Copy the minified code, and check the size reduction shown below the output.

  • Restructures CSS with csso, merging duplicate rules and shortening values
  • Keeps /*! … */ comments for licence headers
  • Downloads the result as minified.css
  • Shows the original size, the minified size and the percentage saved
  • Copy the result or download it as a file
  • Runs in your browser — free, no sign-up, and your code is never uploaded

Developers without a build step

Developers shrink a stylesheet before uploading it by hand.

Theme and template authors

Authors ship a compact stylesheet alongside the readable one.

Site owners

Owners check how much smaller their CSS can get before automating it.

Students

Students learn which CSS changes are safe for a minifier to make.

Minify another language

Examples

CSS Minifier examples

3 worked examples

01

Shorthand margin values

"margin: 0px 0px 10px 0px;" minifies to "margin:0 0 10px" — csso drops the redundant zero units and trailing zero.

02

A full stylesheet

A 40 KB hand-written stylesheet with comments and whitespace typically minifies down to around 25-30 KB.

03

Duplicate selectors merged

.a{color:red} .a{margin:0} is combined into .a{color:red;margin:0}, since both rules target the same selector.

FAQ

Frequently asked questions

Quick answers to common questions about the CSS Minifier.

How do I minify CSS?

Paste your CSS code above, make sure CSS is selected, then click Minify. The minified output appears in the box below it — everything runs in your browser, using csso.

Is this CSS minifier free?

Yes. It's free, with no sign-up and no limit on how much code you minify.

Does it just remove whitespace, or does it restructure rules too?

Both — csso is a structural minifier, so beyond stripping whitespace and comments it also merges compatible rules and shortens values, like turning "margin: 0px 0px 10px 0px" into "margin:0 0 10px".

Will minifying change how my CSS looks or behaves?

It shouldn't — csso only applies transformations that preserve the same computed styles. Always spot- check the result visually before shipping it, as with any build step.

Is my CSS uploaded anywhere?

No. Minification runs entirely in your browser after csso loads from this site — your code never leaves your device.

Can I minify JavaScript or HTML here too?

Yes — switch the language dropdown, or use the dedicated JavaScript minifier or HTML minifier page.

Does it remove comments?

Regular comments are removed. Comments that start with /*! — the usual way to mark a licence or copyright notice — are kept, so those headers survive minification.

Can I download the minified CSS?

Yes — click Download to save it, or Copy to grab it. A small panel shows the original size, the minified size and the percentage saved.

Does it add vendor prefixes?

No. csso only makes your CSS smaller; it doesn't add or remove prefixes like -webkit-. Use a tool such as Autoprefixer in your build for that.

Still have a question? Contact us

Report a problem

CSS Minifier

What went wrong?
    or paste a screenshot