Your stylesheet can be made smaller in two completely different ways, and the two are constantly confused. Minification rewrites the CSS itself, producing a smaller file that you store and serve. Compression leaves the file alone and squeezes it only for the journey between server and browser. People compare them as rivals, minified vs compressed, but they operate at different moments, and the fastest sites use both.
This guide separates the two techniques: what each does, what each cannot do, and where the free CSS Minifier on Ovatly fits. Its part is the one-time rewrite, and it reports exactly what that rewrite achieved: characters in, characters out and the percentage saved.
Contents
- Quick answer
- What minification actually does
- What compression actually does
- The key differences, side by side
- Why they stack instead of competing
- How to minify your CSS, step by step
- Worked example: one rule through both techniques
- Limitations and honest expectations
- Common mistakes
- FAQs
- Conclusion
Quick answer
Minification is a permanent edit to the text: comments removed, whitespace collapsed, spaces around punctuation dropped, a smaller file saved. Compression is a temporary squeeze for transport: the server encodes the response with gzip or Brotli, and the browser decodes it back to identical bytes before using it. Minify with a tool like the CSS Minifier first, then let the server compress the minified file for delivery. Neither technique does the other's job.
What minification actually does
Minification works on the text of the stylesheet, once, before the file is ever requested. It removes everything the browser's parser never needed: comments written for humans, blank lines and indentation, and the spaces around braces, colons and semicolons.
The result is a new file with the same meaning and fewer characters, from a minifier that is careful about the boundary between decoration and meaning. It protects strings and url(...) values, including data URIs, copying them verbatim, and it preserves the spaces inside calc(), min(), max() and clamp() where the CSS specification requires them, along with the spaces that make .nav ul li a descendant selector. What it will not do is rewrite values or restructure rules: no renamed classes, no merged rules, no removed unused CSS, no shortened colors. Those belong to a full optimizer in a build pipeline.
Because the edit is permanent, the minified file is what gets stored, cached and served. Every visitor benefits on every request, and the size report tells you how large the saving was for your stylesheet.
What compression actually does
Compression works on bytes in transit, per response. When a browser asks for a stylesheet, it advertises that it can accept compressed responses. The server then encodes the file with a general-purpose algorithm, usually gzip or the newer Brotli, and sends the squeezed version. The browser decompresses it and parses the result, which is byte-for-byte the file the server holds.
Two properties follow. First, the stored file never changes: compression happens to the response, not to your CSS. Second, compression is indifferent to what the text means. It does not know CSS from prose; it exploits repetition in any byte stream, which is why it shrinks almost any text file, minified or not.
Compression settings live on the server or CDN, and the details vary by host. The division of labor is the point: compression can only squeeze the file it is given, and a file full of comments makes it carry bytes that never needed to exist.
The key differences, side by side
Minification happens once, at build or save time; compression happens on every transfer. Minification changes the stored file; compression changes only the wire format. Minification understands the language, at least enough to know which spaces are safe to drop and which must be protected; compression understands nothing about CSS and treats the file as raw bytes.
And the savings differ in kind. Minification removes bytes permanently, so they are gone from storage, from caches and from every transfer. Compression removes nothing; it encodes the same bytes more efficiently for one trip, and the full size reappears in the browser the moment it arrives.
Why they stack instead of competing
Because the two savings multiply rather than overlap. Minification deletes the bytes that carry no meaning: the comments, the indentation, the ceremony. Compression then packs the remaining, meaningful text tightly for transport. A minified stylesheet compresses at least as well as the original, usually better, because what survives is dense and repetitive.
Skipping minification means your server spends compression effort shipping comments to every visitor. Skipping compression means your minified file still travels at full text size. The standard setup is both, in that order.
How to minify your CSS, step by step
- Keep your readable stylesheet as the source and plan a separate minified output, such as styles.min.css.
- Open the CSS Minifier and paste your CSS into the input box. It expects plain CSS, so compile SCSS or Less first if you use a preprocessor.
- Press Minify CSS.
- Check the size report: characters in, characters out and the percentage saved. That is the minification half of your total saving, measured rather than guessed.
- Copy or download the minified CSS, serve that file, and make sure your server or CDN applies gzip or Brotli compression to CSS responses so the transfer half happens too.
- Load your critical pages once to confirm they render as before, especially if your CSS uses unusual hacks.
Worked example: one rule through both techniques
Start with the tool's own example rule, 30 characters of text:
.nav ul li { margin: 0 10px; }
Minification produces:
.nav ul li{margin:0 10px}
Now the file holds 25 characters: the meaningless spaces are gone, while the descendant selector spaces and the space inside 0 10px survive because they carry meaning, exactly as calc(100% - 20px) keeps the spaces around its minus sign. Those 25 characters are what is stored and cached.
Compression enters only when someone requests the file. The server squeezes those 25 characters for the trip and the browser restores all 25 on arrival. Scale that up to a real stylesheet and the pattern holds: minification decides how many characters exist, compression decides how tightly they travel. The size report in the tool gives you the first number for your actual file; your server logs show the second.
Limitations and honest expectations
The minifier's saving is bounded by its caution. It does not rename classes, merge rules or remove unused CSS, and it does not shorten colors or strip zero units, so a build pipeline optimizer like Lightning CSS will save more. It also expects plain CSS; preprocessor code must be compiled first. Compression, for its part, is outside this tool entirely: it is configured on your server or CDN. What the tool does give you is the exact minified size, so you can see whether the minified file is worth shipping before you think about transport.
Common mistakes
- Treating the two as alternatives. Choosing compression instead of minification ships your comments to every visitor, just squeezed. Do both.
- Expecting compression to shrink the stored file. It never touches the file on disk. Only the response is smaller.
- Expecting minification to shrink the transfer too. The file still travels at its full remaining size unless compression is on.
- Minifying after compressing. The order is fixed: edit the text first, then squeeze it for the trip.
- Pasting SCSS or Less. The minifier expects plain CSS. Compile first.
FAQs
What is the difference between minified and compressed CSS? Minification changes the file itself: comments and spare whitespace are removed once, and the smaller text is what gets stored and served. Compression changes only the transfer: the server squeezes the file with gzip or Brotli, and the browser decompresses it back to the exact original bytes before parsing it.
Does compression change my CSS file on the server? No. The file on disk stays exactly as you saved it. Compression is applied to the response as it travels, and the browser undoes it on arrival. Nothing about your source or your minified file changes.
Should I use both minification and compression? Yes, they do different jobs and stack. Minification removes bytes that never needed to exist, and compression then squeezes what remains for the trip. A minified file also compresses well, because what is left is dense, repetitive text.
Why is the saving from this minifier smaller than a build pipeline's? This tool sticks to transformations that cannot change meaning: it does not rename classes, merge rules, remove unused CSS or rewrite values like turning #ffffff into #fff. A full optimizer in a build pipeline, such as Lightning CSS, goes further and saves more.
Is my CSS uploaded anywhere? No. The minifier runs locally in your browser, so your stylesheet never leaves your device.
Conclusion
Minified vs compressed is not a contest. Minification is the one-time edit that makes the file itself smaller, with the CSS Minifier reporting the exact saving; compression is the per-trip squeeze your server applies to whatever file it is given. Use the edit first and the squeeze second, and the two savings compound. Knowing the distinction also sharpens how you use the minifier itself: our companion guide on CSS minification mistakes that break layouts covers the workflow errors behind most layout surprises, and the rest of the Developer Tools guides cover the remaining tools in the category.