CSS Minifier

Online CSS Minifier

Compress a stylesheet by removing comments, line breaks, indentation, and other characters the browser does not need. The minifier works on the structure of the CSS rather than blind find-and-replace, so text inside quotes, url() values, calc() expressions, and descendant selectors are never broken.

Features:

  • Comment and whitespace removal: including spaces around braces, colons, commas, and selector combinators.
  • Small safe optimisations: #ffffff → #fff, 0.5em → .5em, no final semicolon, empty rules removed.
  • Licence comments kept: /*! ... */ comments stay unless you untick the option.
  • Size report: see the original size, the minified size, and the percentage saved.

1. What Is Left Alone

Spaces that change meaning are kept. div :first-child (any first child inside a div) is different from div:first-child (a div that is a first child), and calc(100% - 10px) needs the spaces around the minus sign. Strings, url() values, and custom property values are never rewritten.

2. Minify in Your Build for Production

For a one-off file or a quick size check, this tool is enough. For a production site, add a minifier such as cssnano or Lightning CSS to your build so every deploy is minified automatically, and serve the files with gzip or Brotli compression. Learn more in our guide: How CSS Minification Works.

Can I turn minified CSS back into readable CSS? Yes. Paste it into the CSS Beautifier to restore indentation and line breaks. Removed comments cannot be recovered.
Does minifying CSS improve page speed? Yes, a little: smaller CSS downloads and parses faster, and CSS blocks rendering, so it matters more than most file types. Compression on the server saves even more.

Need the reverse? Format minified CSS back to readable with the CSS Beautifier.

100% client-side: your code is never uploaded.

Related Tools