Minify CSS without breaking selectors

Remove whitespace and comments, then test calc(), custom properties and data URLs.

Privacy-first — processing mode is labeled on each tool page2026-11-17

CSS minification is usually safe, but whitespace-sensitive syntax and long data URLs are where hand-written regex breaks. Use a real parser and test the rendered page.

Tool used in this guide

CSS minifier

Open tool

How to use it

  1. 1

    Keep the readable source

    Work from a version-controlled or backed-up stylesheet. Minified CSS is hard to edit, and you will want the readable file the next time a selector changes.

  2. 2

    Minify with a parser, not a regex

    Paste the stylesheet into the tool and let it parse the rules. Watch for calc() expressions, custom properties and strings where spaces are meaningful.

  3. 3

    Check data URLs and media queries

    Long base64 data URLs and media query conditions are common breakage points. Search the output for the original URL and compare a before/after fragment.

  4. 4

    Test the page and measure the gain

    Load the page with the minified file, check the browser console, and compare the transferred size. A small byte saving is not worth a broken mobile layout.

Use the tool for this task

CSS minifier

Remove comments and redundant whitespace from CSS while keeping quoted strings and calc() expressions intact.

Open tool

Frequently asked questions

Does minifying CSS improve performance?

It reduces transfer size and parsing work, but the bigger wins usually come from removing unused rules and compressing at the server. Minify as one step, not the whole strategy.

Can I minify CSS with comments needed for licensing?

Preserve license comments that your dependencies require. A good minifier can keep /*! ... */ comments; check the output before shipping.

Related tools