CSS Minifier
Minify CSS to cut file size: removes whitespace and comments, shortens colours and values, and merges rules. Runs entirely in your browser.
Runs in your browser. Nothing is uploaded.
About the CSS Minifier
Every byte of CSS has to download and be parsed before a page can render, because browsers block rendering until stylesheets are ready. Minifying removes what browsers do not need: comments, indentation, line breaks and redundant characters.
Beyond removing whitespace, the minifier rewrites values in shorter equivalent forms, such as #ffffff to #fff and 0px to 0, and can merge rules that share a selector or declarations. The result behaves the same but is noticeably smaller, even before the server compresses it. Minify a copy for production and keep your readable source for editing; most build tools do the same as part of a release.
How to use the CSS Minifier
- 1
Paste your CSS, open a .css file, or load the sample. Pasting, opening a file or loading the sample runs it automatically.
- 2
Leave “Merge rules” on for the smallest output, or turn it off to keep the original rule order.
- 3
Turn on “Keep /*! */ comments” if your CSS includes a licence banner that must be preserved.
- 4
Press Minify. The status bar shows how many bytes were saved.
Examples
/* button */
.btn {
color: #ffffff;
margin: 0px 0px 0px 0px;
}.btn{color:#fff;margin:0}Good to know
- “Merge rules” can reorder declarations. If your CSS relies on a specific cascade order across duplicate selectors, test the result or turn the option off.
- Invalid CSS is passed through as-is rather than reported as an error.
Frequently asked questions
How much smaller will my CSS get?
It depends on the source. Hand-written, commented CSS often shrinks by 20–40%. Already-minified CSS will barely change.
Should I still use gzip or Brotli on my server?
Yes. Minification and compression work together: minify first, then let your server compress the file for transfer.
Is my code uploaded to a server?
No. Processing happens entirely in your browser, in a background thread. Your input is never sent to our servers or stored anywhere.
Related tools
More tools that pair well with this one.