CSS Minifier

Minify CSS and merge duplicate rules.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

CSS Minifier – Minify CSS Online

The CSS minifier shrinks stylesheets so they download faster. It is powered by csso (CSS Optimizer), which goes beyond removing whitespace: it understands CSS and applies safe structural optimizations. After minifying you see how many bytes and what percentage you saved.

Optimizations

  • Whitespace and comments – all unnecessary spaces, line breaks, and comments are removed.
  • Shorter values – #ff0000 becomes red, #ffffff becomes #fff, 0px becomes 0, and redundant units and zeros are dropped.
  • Shorthand merging – padding: 16px 24px 16px 24px becomes padding:16px 24px.
  • Rule restructuring – rules with identical declarations are merged (a{color:red} and b{color:red} become a,b{color:red}), and duplicate declarations are removed.
  • Last semicolons – the final semicolon in each block is dropped.

Options

  • Merge rules (restructure) – enables structural optimizations. Turn it off if you want the output to keep the original rule order and structure exactly, with only whitespace and values minimized.
  • Keep /*! license */ comments – preserves important comments, often required by font and framework licenses.

How to minify CSS

Paste your stylesheet, open a .css file, or click Sample. The minified CSS appears instantly; copy it or download it as styles.min.css.

Minify vs. gzip

Servers usually compress CSS with gzip or Brotli. Minification and compression work together: minified files compress even better, and minification removes bytes that compression cannot, such as comments and long color values.

Expand minified CSS again with the CSS Beautifier, find mistakes with the CSS Validator, and minify the rest of your site with the JS Minifier and HTML Minifier.

Frequently Asked Questions

csso only merges rules when it can prove the result is equivalent. In rare cases involving overlapping selectors and specificity tricks, turning off Merge rules gives a more conservative result.

No. Removing selectors that are not used on your pages requires analysing your HTML, which tools like PurgeCSS do. The minifier keeps every rule.

Usually 20–50% for hand-written CSS. The savings chips show the exact numbers.