How to Minify CSS
Minifying CSS removes everything a browser does not need — whitespace, comments, the last semicolon in a rule, units on zero values. Typically it cuts a stylesheet by 20 to 40 percent, and since CSS blocks page rendering until it loads, that saving translates fairly directly into a faster first paint.
Paste or load your CSS
A single file or a whole stylesheet. Drop a .css file onto the box if you prefer.
Choose what to strip
Comments, empty rules and hex shortening are all optional, and licence comments can be kept.
Copy the result
The savings are shown in bytes and percent, so you can see whether it was worth it.
Why Naive Minifiers Break CSS
The obvious approach is to strip whitespace with a regular expression, and it works until it meets CSS where whitespace is the content. content: "Hello world" renders those three spaces. A font family called "Helvetica Neue" needs its space. A base64 data URI inside url() can contain characters that look like CSS syntax but are not.
This minifier tokenises the stylesheet first, pulling out strings, comments and url() values as complete units before touching anything. Only the remaining structural text is compressed. That is why the sample includes a deliberately awkward case — a filename with a space inside url(), and a content string with multiple spaces. Both survive.
The other safeguard worth mentioning is licence comments. A comment beginning /*! is the convention for a notice that must legally remain in the file. Stripping those from a library you did not write can put you in breach of its licence, so they are preserved by default.
What Actually Gets Removed
Whitespace and line breaks
The largest single saving in most stylesheets. Browsers do not care about formatting, only about the rules themselves.
Units on zero and leading zeros
0px becomes 0, and 0.5rem becomes .5rem. Both are identical to the browser and both save a few bytes per occurrence.
Redundant hex digits
#ffffff becomes #fff when each pair repeats. Lossless, and it adds up across a colour-heavy stylesheet.
Empty rules
A selector with no declarations does nothing at all. These accumulate as stylesheets are edited and are pure dead weight.
Frequently Asked Questions
How do I minify CSS online for free?
Paste your CSS and the minified version appears immediately, with the savings shown. Free, no signup.
Is my CSS uploaded to a server?
No. Everything is processed in your browser, which matters for unreleased designs and internal projects.
Will minifying break my CSS?
It should not. Strings, comments and url() values are tokenised out before anything is stripped, so spacing that matters is preserved.
How much smaller will my file be?
Typically 20 to 40 percent, depending on how much whitespace and commenting the original has. The exact figure is shown above.
What are licence comments?
Comments beginning /*! which mark notices that must legally remain in the file. They are preserved by default.
Does gzip make minifying pointless?
No. Gzip compresses the minified file further, and the two savings compound. Minified plus gzipped is meaningfully smaller than gzipped alone.
Can I beautify minified CSS?
Yes, switch to Beautify. It rebuilds proper indentation, which is useful when reading a stylesheet you did not write.
Why does it shorten hex colours?
Because #ffffff and #fff are identical to the browser. It is a lossless saving, and you can turn it off.
Does it remove vendor prefixes?
No. Those target specific browsers and removing them would change behaviour. Use an autoprefixer to manage them properly.
What about empty rules?
They are removed by default. A selector with no declarations does nothing and only adds bytes.
Is there a file size limit?
Files above 5 MB are rejected because browser processing becomes slow.
Is this CSS minifier really free?
Completely free, with no limits, no signup and no premium wall.
Last updated: July 24, 2026 · FlipMyFormat CSS Minifier
Written and maintained by the FlipMyFormat team
