CSS Minifier & Beautifier

Free CSS minifier and beautifier. Compress stylesheets with CSSO, see the bytes and gzip size saved, or pretty-print minified CSS. Runs in your browser.

Paste CSS to minify it with CSSO, which removes whitespace and comments, shortens colours and numbers, and can restructure rules by merging duplicate selectors and declarations. Switch to Beautify to re-indent minified CSS with js-beautify. The savings panel shows the original and minified size, the percentage saved and an estimated gzip size. Everything runs in your browser.

Runs in your browser. The processing engine downloads once on first use, then the tool works offline. Your files never leave your device. Free, no sign-up.

Features

How to use CSS Minifier & Beautifier

  1. Paste your CSS or open a .css file.
  2. Choose Minify or Beautify; for Minify pick whether to restructure rules and keep /*! comments.
  3. Watch the result update on the right, with bytes and gzip saved.
  4. Copy the output or download it as a .css file.

Frequently asked questions

What does a CSS minifier remove?

It removes whitespace, line breaks and comments, drops the last semicolon in each block, shortens colours (#ffffff becomes #fff) and zero values, and removes rules that are empty. The stylesheet renders exactly the same but is smaller.

What does "restructure" do?

Restructuring lets CSSO merge rules with the same selector or the same declarations and remove declarations that are overridden later. It usually saves more bytes, but it changes the order of rules, so turn it off if your CSS depends on a very specific cascade order.

How much smaller will my CSS get?

Hand-written, well-commented CSS commonly shrinks by 20 to 50 percent before gzip. After gzip the difference is smaller because compression already removes much of the repetition, which is why the tool shows both numbers.

Can I un-minify CSS?

Yes. Beautify mode re-indents minified CSS and puts each declaration on its own line. Comments that were removed during minification cannot be recovered.

Should I minify CSS myself or in my build?

Build tools such as Vite, webpack and PostCSS minify CSS automatically for production. A quick online minifier is handy for a snippet, an email template, a WordPress theme or a static page without a build step.

Is my CSS uploaded?

No. CSSO and js-beautify are downloaded once from a public CDN and run in your browser; your stylesheet stays on your device.

Related tools

All free tools · This tool as Markdown