Home » Developer Tools » CSS Minifier

Free CSS Minifier Online

Shrink your stylesheets in seconds without changing how your site looks.

Last updated 13 November 2026

Upload a file: or paste code below.
Input0 chars
Output0 chars
Original size0 B
Result size0 B
Change0%

Your code never leaves your browser. Everything runs locally on your device.

Large stylesheets slow down a page because every extra space and comment adds bytes that a browser must download. The CSS Minifier removes that extra weight in seconds, so your styles load faster without changing how your site looks.

Paste your stylesheet below or upload a CSS file, and the tool strips comments, collapses spaces, shortens colors, and drops units from zero values. Your original code stays in the input box, so you can compare the result and copy the smaller version when you are ready.

How to Minify CSS

  1. Paste or upload your CSS. Type or paste your stylesheet into the input box, or choose a CSS file from your device.
  2. Choose your options. Keep comment stripping on to remove comments, or switch it off if you want to keep them in the output.
  3. Click Minify CSS. The tool runs at once and also updates live as you type, so you always see the latest result.
  4. Copy or download the result. Use the copy button to grab the minified code, or download it as a ready to use CSS file.

Why Use This CSS Minifier

What Is a CSS Minifier

A CSS minifier is a tool that takes a readable stylesheet and removes every byte a browser does not need. It deletes comments, collapses extra spaces and line breaks, drops the unit from zero values, and shortens color codes where the shorter code means the same color. The rules stay the same and the page looks the same, but the file is smaller. Use it on the file you publish, and keep your readable original for editing. If you ever need to read a minified file again, the CSS Beautifier formats it back into neat indented code.

What Gets Removed

Minifying only removes things that do not change how the CSS works. Here is what this tool strips from your code, and what it leaves alone.

What is removedExample
CommentsA note inside /* */ is deleted
Extra spaces and line breaksLong gaps collapse to a single space or nothing
Units on zero values0px becomes 0
Doubled hex color codes#ffffff becomes #fff
Spaces around symbolsbody { margin : 0 ; } becomes body{margin:0}

Strings, file paths in url values, calc values, and rules inside media queries are left alone, so your styles keep working exactly as before.

Minify vs GZIP/Brotli

Minifying and compression solve different problems, and they work best together. Minifying removes bytes from the file itself, so the file you store and serve is smaller. GZIP and Brotli compress the file while it travels from the server to the browser, and the browser expands it again on arrival.

A minified file also compresses better, because there is less repeated whitespace for the compressor to chew through. Minify once when you publish, and let your server apply GZIP or Brotli on every request. One does not replace the other.

Why It Matters

A browser reads your CSS before it paints the page, so a large stylesheet holds up everything the visitor sees. This is called render blocking: the page cannot show its final layout until the CSS arrives and is read. A smaller file arrives sooner, so the page paints sooner.

That shows up in the numbers Google measures. First Contentful Paint marks the moment the first text or image appears, and Largest Contentful Paint marks the moment the main content appears. Both improve when the CSS file is smaller, and the gain is largest on slow mobile connections, where every kilobyte costs real time.

When to Minify

Minify every stylesheet you publish, and minify again after each edit, since even a small change can add back the spaces you removed. Keep the readable original as your working copy and publish only the minified file. Minify your other code too: use the HTML Minifier for your pages and the JavaScript Minifier for your scripts, so the whole page ships smaller. And if you need to read any of them again later, the HTML Beautifier and the JavaScript Beautifier format them back into readable code.

Worked Example

Here is a small stylesheet run through the tool, with the exact numbers:

Input, 68 characters:

body { margin: 0; padding: 0; color: #333; } h1 { font-size: 24px; }

Output, 53 characters:

body{margin:0;padding:0;color:#333}h1{font-size:24px}

The output is 53 characters, down from 68. That is 15 characters removed, and 15 divided by 68 is 0.2206, so the file is about 22 percent smaller. Larger files with more comments and spacing shrink by more, since there is more waste to remove.

Frequently Asked Questions

Does the CSS Minifier change how my styles look?

No. It only removes comments and extra spaces and shortens values that mean the same thing, so your page looks exactly the same after minifying.

Is it safe to minify CSS with comments inside strings?

Yes. Text inside quotes is left untouched, so a value that looks like a comment marker stays exactly as you wrote it.

What happens to zero values and color codes?

Zero values lose their unit, so 0px becomes 0, and a six digit color code with doubled pairs becomes a three digit code.

Does the minifier keep media queries working?

Yes. Media queries and other at rules are kept intact, and only the spaces and values inside them are cleaned up.

Is my CSS uploaded to a server?

No. Your CSS is processed only in your browser on your own device, and nothing is sent to a server or stored anywhere.

Can I minify a whole stylesheet at once?

Yes. Paste a full stylesheet or upload a CSS file, and the tool minifies everything in one go, including rules inside media queries.

How much smaller will my file get?

That depends on how much waste your file holds. A file full of comments and extra spacing shrinks a lot, while a file that is already tidy shrinks only a little. The worked example on this page went from 68 characters to 53 characters, about 22 percent smaller. Paste your own file into the tool above and the Change figure shows your exact result.

What is the difference between minifying and gzip?

Minifying removes bytes from the file itself, while gzip compresses the file as it travels from the server to the browser. They do different jobs, so use both: minify the file once when you publish, and let your server apply gzip on every request.

Can I reverse minification?

Yes. Minifying only removes spacing and comments, so the rules are still all there. Paste the minified code into the CSS Beautifier on this site and it formats the code back into neat indented lines you can read and edit.

Does minifying help SEO?

It helps in a small way. Smaller CSS files load faster, and page speed is one of the things search engines look at when they rank pages. Minifying alone will not lift a slow page to the top, but it is a simple win as part of making the whole page faster.

What happens to licence comments that start with /*! ?

They are removed like any other comment when the Strip comments box is ticked. This tool has no option to keep licence comments, so keep the licence text in your readable source file and in any copy you share with others.

Does it work with CSS variables?

Yes. Custom properties and var values are left as written, and only the spaces and comments around them are removed. A rule that sets a variable and a rule that reads it both keep working after minifying.

↑