How to use CSS Minifier
- Paste your CSS into the input box, or click Open a file to load a .css file.
- Keep "Advanced restructuring" on to merge and reorder rules, or turn it off for whitespace and value cleanup only.
- Read the minified CSS in the output box, with the size before and after.
- Click Copy or Download to save styles.min.css.
Features
- Removes comments and whitespace
- Shortens values, for example #ff0000 to red and 0px to 0
- Optional restructuring that merges rules with the same declarations
- Shows bytes before and after and the percentage saved
- Runs in your browser, so the CSS is never uploaded
Supported formats and limits
- Maximum input: 10,000,000 characters
Examples
| Input | Result |
|---|---|
| /* buttons */ .btn { color: #ff0000; margin: 0px 0px 0px 0px; } .btn-alt { color: #ff0000; } | .btn{margin:0}.btn,.btn-alt{color:red} — 100 bytes → 38 bytes. |
Limitations
- Always test the minified CSS on your pages. Advanced restructuring reorders rules, which is safe in most cases but can matter for unusual hacks; turn it off if something looks different.
- Invalid CSS is handled leniently, like a browser, so a typo may be dropped or kept without an error.
- The tool does not remove unused rules or combine several files.
Learn more
CSS files written for people contain comments, indentation and sometimes repeated rules. Browsers ignore all of that, so a minifier can remove it to save bytes, which means less to download and a slightly faster page.
Minifying works at two levels. The simple level removes comments and whitespace and shortens values that can be written more compactly, for example 0px as 0, or #ff0000 as red. The more advanced level, called restructuring, merges rules with the same declarations and removes declarations that are overridden later in the same rule. Because CSS applies the last matching rule, reordering needs care, and mature minifiers only do it when the result is equivalent.
Minified CSS is best produced as a build step from your readable source. Keep the original for editing; serve the minified file, ideally with gzip or Brotli compression on top.
Frequently asked questions
How much smaller will my CSS be?
It depends on how much whitespace, comments and repetition the file has. The tool shows the exact bytes before and after for your CSS.
Is minified CSS safe to use?
It should behave identically in a browser. Test your pages after minifying, especially if you turn on advanced restructuring.
What does advanced restructuring do?
It merges rules that share declarations and removes duplicates, which shrinks the file further but changes the order of rules.
Is my CSS uploaded?
No. Minifying runs in your browser.
Sources
Last reviewed: September 30, 2026