Developer tools

CSS Minifier

CSS Minifier

Minify CSS safely by removing comments and whitespace.

About this tool

About CSS Minifier

Make a stylesheet smaller before you deploy it or paste it into a <style> tag. The minifier removes comments, line breaks and indentation, drops the spaces around braces, colons, semicolons, commas and child combinators, and removes the last semicolon in each block. It is careful about the places where whitespace carries meaning: the spaces inside calc(100% - 2rem) are required, a space before a pseudo-class as in .menu :hover means something different from .menu:hover, and text inside quotes or an unquoted url() path is copied unchanged. Licence comments that start with /*! are kept by default, as most open-source licences require. Rules are not merged, reordered or rewritten, so the minified file behaves exactly like the original and there are no surprises in older browsers. The output size and saving are shown, and you can download the result as a .min.css file. Everything happens locally in your browser.

Built and maintained by Abhi JainUpdated

How to Minify CSS

  1. 1

    Paste or open CSS

    Paste CSS into the left pane or open a .css file.

  2. 2

    Decide on licence comments

    Keep /*! licence */ comments is on by default; turn it off to remove every comment.

  3. 3

    Copy or download

    Copy the minified CSS or download it as a .min.css file.

CSS Minifier: questions and answers

How much does minifying CSS save?

It depends on how many comments, blank lines and how much indentation the stylesheet has. The exact size and saving are shown under the panes.

Will minified CSS work the same?

Yes. Only characters that CSS ignores are removed. Selectors, values and the order of rules are unchanged.

What is the difference between minifying and compressing CSS?

Minifying removes characters from the file itself. Compression such as gzip or Brotli is applied by the web server on the fly. Both together give the smallest download.

Can I get readable CSS back?

Yes. Switch Mode to Beautify to indent the minified CSS again. Removed comments cannot be recovered.

More CSS Formatter presets