CSS Minifier

Minify CSS to reduce file size

Remove comments and unnecessary whitespace from CSS while keeping strings intact, optionally preserving /*! license */ comments.
Try an example:

Output will appear here...

About CSS Minifier

How it works

  1. String values (like content: "a b") are protected so their spacing is not changed.
  2. Comments are removed, whitespace is collapsed, and spaces around { } ; : , > are dropped.
  3. The last semicolon before each } is removed - it is optional in CSS.

What you need

  • CSS code.

Tips

  • Libraries mark their license with /*! … */ - keep it when you redistribute.

Limitations

  • This is a safe whitespace minifier; it does not merge duplicate rules or shorten colours like an advanced optimiser.

Runs in your browser. Everything happens in your browser - your code and data are never uploaded.

Frequently asked questions

How much does minifying CSS save?+

Usually 15-30% of the file size before compression. Combined with gzip or brotli on the server, CSS files often shrink by 80% or more.