FOR WEB DEVELOPERS

CSS Minifier

Minify CSS by removing whitespace and comments, shortening colors and values, and merging duplicate rules. Free and in your browser.

Code stays on your device

1 Your CSS

Processed in your browser. Nothing is uploaded.
THREE SMALL STEPS

How to minify CSS

  1. 01

    Paste your stylesheet

    Paste the CSS from a file or a style tag, including media queries and custom properties.

  2. 02

    Decide on restructuring

    Leave rule merging on for the smallest file, or turn it off to only remove spaces, comments and redundant values.

  3. 03

    Use the minified CSS

    Copy the result or download it as styles.min.css, then link that file from your pages.

BEFORE YOU START

Good to know

Merging keeps the cascade

Rules are merged in a way designed to keep the same cascade. If a page looks different, turn restructuring off and minify again.

License comments stay

Comments that start with /*! are kept, so copyright notices required by a license remain in the file.

Validate first

The minifier does not report invalid CSS, so validate your stylesheet and test the minified file in the browsers you support.

QUESTIONS

Frequently asked questions

Should I minify CSS before or after compiling Sass?

Compile Sass or Less to regular CSS first, then paste that CSS here. This tool compresses CSS and does not compile preprocessor syntax. Keep your editable source separately from the minified output.

How much smaller will my CSS be?

It depends on how much whitespace, comments and repetition the file has. The tool shows the size before and after and the percentage saved.

Can I minify Sass or Less?

No. Compile Sass or Less to CSS first, then paste the compiled CSS here.

Will the minified CSS work in the same browsers?

Yes. The minifier does not add new syntax: it shortens what is already there, for example #ffffff to #fff and 0px to 0.