Home » Developer Tools » CSS Minifier
Shrink your stylesheets in seconds without changing how your site looks.
Last updated 13 November 2026
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.
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.
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 removed | Example |
|---|---|
| Comments | A note inside /* */ is deleted |
| Extra spaces and line breaks | Long gaps collapse to a single space or nothing |
| Units on zero values | 0px becomes 0 |
| Doubled hex color codes | #ffffff becomes #fff |
| Spaces around symbols | body { 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.
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.
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.
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.
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.
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.
Yes. Text inside quotes is left untouched, so a value that looks like a comment marker stays exactly as you wrote it.
Zero values lose their unit, so 0px becomes 0, and a six digit color code with doubled pairs becomes a three digit code.
Yes. Media queries and other at rules are kept intact, and only the spaces and values inside them are cleaned up.
No. Your CSS is processed only in your browser on your own device, and nothing is sent to a server or stored anywhere.
Yes. Paste a full stylesheet or upload a CSS file, and the tool minifies everything in one go, including rules inside media queries.
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.
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.
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.
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.
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.
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.
If you also work with markup, try the HTML Minifier to shrink your HTML pages in the same way before you publish them.