CSS Minifier

CSS Minifier

Minify CSS instantly and download the result as a .css file.

Original: 0 bytes Minified: 0 bytes Saved: 0%

CSS written for people — indented, spaced out and commented for clarity — carries bytes the browser never needs in order to render the page. A CSS minifier strips all of that back to the minimum the browser actually reads, without changing how anything looks or behaves.

This CSS minifier tool works entirely in the browser, shows the original and minified size with the percentage saved, and lets you copy the result or download it as a .css file.

How to Use the CSS Minifier

Everything runs in your own browser — your CSS is never uploaded to a server.

What Is CSS Minification?

When You Would Use This

Worked Example

Before minification:

.card {

background-color: #ffffff;

padding: 20px;

/* rounded corners for a more subdued aesthetic */

border-radius: 8px;

}

After minification:

.card{background-color:#fff;padding:20px;border-radius:8px}

The comment, the line breaks and the indentation are gone, the last semicolon before the closing brace is dropped, and #ffffff is shortened to its three-digit form. That is 131 bytes down to 59 — 55.0% saved — and the page renders exactly the same.

Minifying CSS in Code

Node.js with clean-css

clean-css is a Node package that minifies CSS inside a build script or on the server.
const CleanCSS = require("clean-css");
const output = new CleanCSS().minify(".card { color: red; }");
console.log(output.styles);

Build Tools

Most modern bundlers (webpack, Vite, Parcel) minify CSS as part of a production build, using a plugin such as cssnano or clean-css. A tool like this one is for everything in between: a quick fix, a one-off file, or a project with no build pipeline.

Do’s and Don’ts

Do

Don’t

Common Mistakes

Good to Know

Frequently Asked Questions

What does CSS minification actually remove?

Whitespace, line breaks, indentation and comments — everything the browser does not need in order to apply your styles. It also drops the final semicolon before a closing brace and shortens hex colours such as #ffffff to #fff.

Will minifying break my site?

No. Done properly it is lossless: the appearance and the behaviour stay exactly the same, and only the file size changes.

How much smaller does a minified CSS file get?

Usually 20 to 40 percent smaller, depending on how much whitespace and commenting the original file was carrying.

Is minifying the same as gzip compression?

No. Minification removes characters from the file itself; gzip and brotli compress whatever is left while it is being transferred. Using both together is the most effective.

Should I minify CSS while I am still developing?

No. Work in the readable source file and minify at the end, just before you deploy.

Can I edit CSS after it has been minified?

You can, but it is awkward and easy to get wrong because none of the formatting survives. Edit the source file instead and minify it again.