Developer

CSS Minifier

Minify CSS by stripping comments and whitespace safely. Runs in your browser with no upload, and reports the byte saving before and after gzip.

Last reviewed by the Radiatus Cloud team

Need this built for your product?

We design, build & host secure software & APIs.

Talk to an engineer

What minification actually removes

Minifying CSS strips the bytes a browser does not need: comments, indentation, newlines, the space after a colon, and the final semicolon in a block. None of it changes how the stylesheet behaves. For hand-written CSS the saving is typically 15 to 30 percent of the raw file.

Minification and compression are not the same thing

This is the part most people get wrong. Gzip and Brotli already collapse repeated whitespace very effectively, so the additional saving from minification after compression is much smaller than the raw numbers suggest, often only a few percent. Minification is still worth doing, because it reduces parse time as well as transfer size, but the honest framing is that compression does most of the work. If your server is not compressing CSS at all, fixing that matters far more than minifying.

What must not be removed

Whitespace is significant in several places and a naive minifier breaks them. Inside calc() the spaces around + and - are required by the grammar: calc(100%-20px) is invalid, while calc(100% - 20px) is correct. Descendant combinators are spaces, so removing the space in .a .b turns it into a completely different selector. Spaces inside quoted strings, attribute selectors and content values are literal. Comments beginning /*! are conventionally preserved because they carry licence text.

Order is not safe to change

Minifiers that merge duplicate selectors or reorder declarations can silently change specificity outcomes and cascade behaviour, particularly with vendor prefixes or intentional overrides. This tool restricts itself to removing insignificant characters and does not reorder or merge rules, which makes the transformation predictable.

Keep a source map or the original

Minified CSS is effectively unreadable and undebuggable. Always keep the unminified source in version control and minify as a build step rather than editing the minified file. Generating a source map lets browser developer tools point at the original line numbers.

Related tools

  • JSON Formatter — Format and beautify JSON in your browser. Pinpoints syntax errors by line and column, flags unsafe integers, and never uploads your data to a server.
  • JSON Validator — Validate JSON syntax with precise line and column errors, and check documents against a JSON Schema. Runs locally in your browser, nothing uploaded.
  • Regex Tester — Test regular expressions against sample text with live match highlighting, capture groups and flag control. Runs entirely in your browser.
  • HTML Minifier — Minify HTML by removing comments and redundant whitespace, without breaking inline elements or pre blocks. Runs entirely in your browser.

Frequently Asked Questions

How much smaller will my CSS get?

Typically 15 to 30 percent of the raw file for hand-written CSS. After gzip or Brotli the additional saving is much smaller, often only a few percent, because compression already handles repeated whitespace well.

Is minification safe?

Removing comments and insignificant whitespace is safe. Reordering or merging rules is not, because it can change specificity and cascade behaviour. This tool only removes insignificant characters and never reorders declarations.

Why does my calc() break after minifying?

The CSS grammar requires spaces around the plus and minus operators inside calc(). A minifier that strips them produces invalid syntax that browsers ignore entirely. This tool preserves whitespace where it is significant.

Should I minify if my server already uses gzip?

Yes, but for a smaller reason than you might expect. Compression captures most of the transfer saving; minification additionally reduces parse time and the size held in memory. If compression is off, enabling it is the bigger win by far.

Can I recover the original from minified CSS?

You can reformat it, but comments and the original structure are gone permanently. Keep the source in version control and treat minification as a build step, ideally with a source map for debugging.

Privacy & Security

Processing is client-side.

Data: None
Client-side-Side
Active
v1.0

How to Use

Paste CSS code and click Minify to reduce its size.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.