~/frontend-tools/css-minifier
CSS Minifier
Shrink a stylesheet for production. The minifier removes comments and unnecessary whitespace, drops the final semicolon in each block and shortens colours like #ffffff to #fff, while leaving strings, URLs and /*! licence */ comments untouched. You see exactly how many bytes you saved.
Using the CSS Minifier
What minifying does
Browsers ignore comments, indentation and most whitespace, but every character still has to be downloaded. Minifying removes them so the file is smaller and arrives faster. On a typical hand-written stylesheet the saving is 20 to 40 percent before compression.
What it keeps safe
The minifier works on CSS tokens, not blind text replacement, so content inside strings and url() stays exactly as written. Comments that start with /*!, the convention for licence notices, are kept. Spaces that matter, such as inside calc(100% - 2rem), are preserved.
Minify and compress
Servers usually compress files with gzip or Brotli as well. Compression and minification work together: minify first, then let the server compress. The saving shown here is before compression.
Keep the original
Always edit the readable version and minify a copy for production. If you need to read a minified file later, the CSS formatter will expand it again.
Minifying in a build pipeline
For a project you update often, add minification to your build instead of doing it by hand: most bundlers and frameworks minify CSS automatically in production mode. This tool is ideal for one-off files, theme editors, email templates and quick checks of how much a stylesheet can shrink.
Frequently asked questions
Can minifying break my CSS?
It should not: the changes are safe ones. Always test the result, especially with unusual hacks or invalid CSS.
Does it merge duplicate rules?
No. It does not restructure rules, which keeps the output predictable.
Is my stylesheet uploaded?
No. Everything happens in your browser.