CSS Minifier
Minify CSS by stripping comments and whitespace — paste stylesheet, copy the smaller output.
What gets removed
The minifier makes four passes over your stylesheet:
- Deletes every
/* … */comment. - Collapses all whitespace, line breaks included, to single spaces.
- Removes the spaces around
{ } : ; , > + ~. - Drops the last semicolon before each closing brace.
The sample on the page goes from 117 characters to 73:
That's all it does. It doesn't shorten 0.9 to .9, rewrite colours, merge duplicate selectors or drop unused rules, so the output is easy to compare with your source when something looks off.
Two cases where the output behaves differently
Removing spaces around + and : is usually harmless, but not always:
- Addition inside
calc(): CSS needs spaces around+there.calc(1em + 4px)becomescalc(1em+4px), which browsers reject, so the whole declaration is ignored. Subtraction is safe, because the tool leaves spaces around-alone:calc(100% - 2 * 10px)comes through intact. Rewrite additions ascalc(1em - -4px), or fix them in the output by hand. - A space before a pseudo-class:
article :first-childmeans any first child inside an article. Minified, it becomesarticle:first-child, an article that is itself a first child. If you rely on that space, writearticle *:first-childinstead, which minifies safely.
Media queries are fine: @media (min-width: 600px) and (max-width: 900px) comes out as @media (min-width:600px) and (max-width:900px), with the spaces around and kept.
Strings and licence comments
The tool doesn't recognise quoted strings, so the whitespace and comma rules apply inside them. content: "a , b" becomes content:"a,b", which changes what the page displays. Check any content values and quoted font names with unusual spacing.
Licence comments go too. Many libraries start theirs with an exclamation mark right after the opening /* so tools keep them, but this minifier removes every comment, including those. If a licence requires the notice to stay with the code, paste it back at the top of the minified file.
Frequently asked questions
Can I minify SCSS or Less with it?+
Compile to plain CSS first. The tool doesn't remove // line comments, and once whitespace collapses, a // comment can swallow the rules that follow it.
Is it worth minifying if my server already uses gzip or Brotli?+
Yes, the two stack. Minifying removes characters the browser never needed, and compression then shrinks what remains.
Can I turn minified CSS back into readable CSS?+
Not here. A formatter can restore line breaks and indentation, but the comments removed during minifying are gone for good.
Does it handle very large stylesheets?+
It runs in your browser on whatever you paste, so size is limited only by your device.
Embed this tool on your website
Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.
<iframe src="https://utilityapp.lat/embed/dev/css-minifier" title="CSS Minifier" width="100%" height="600" style="border:0;max-width:760px" loading="lazy"></iframe> <p style="font-size:13px"><a href="https://utilityapp.lat/dev/css-minifier">CSS Minifier</a> by UtilityApp</p>