Helper-KitCode Tools

CSS Minifier & Beautifier

Minify CSS to shrink its file size, or beautify minified CSS to make it readable again. Shows the size saved, including after gzip.

CSS
Try an example:
Minified CSS

More:JavaScript MinifierHTML MinifierColor ConverterCSS Cheatsheet

Minifying uses CSSO, which understands CSS properly: it keeps the spaces that matter (in selectors like .card :hover, inside calc() and strings), removes the rest, and can safely merge duplicate rules. Beautifying uses Prettier and also supports SCSS and Less. Minifying expects plain CSS; for SCSS or Less, compile to CSS first. Everything runs in your browser.

About This Tool

Paste CSS, open a .css file or drop one in, and get minified CSS straight away. Minifying uses CSSO, a CSS optimiser that understands the language rather than just deleting spaces. It keeps the spaces that change meaning, such as in .card :hover, inside calc() and inside strings, and removes everything else. With "Merge and shorten rules" on, duplicate selectors are combined and values are shortened (margin: 0 0 0 0 becomes margin: 0, #333333 becomes #333). License comments that start with /*! can be kept so copyright notices survive. Missing or extra braces and unclosed comments are reported with their line and column, and "Show in input" jumps to the problem. Beautify mode does the reverse with Prettier: it turns one long line of CSS back into neatly indented rules, and also formats SCSS and Less. Everything runs in your browser; your code is never uploaded.

Common Use Cases

  • Shrinking a stylesheet before putting it on a live website
  • Making a minified CSS file from a library or theme readable
  • Checking how much smaller a stylesheet gets, including after gzip
  • Finding a missing brace or an unclosed comment in a large stylesheet
  • Tidying SCSS or Less files with consistent indentation

Frequently Asked Questions

Will minifying break my styles?

No. CSSO only removes what has no effect and keeps spaces that matter, such as the one in ".card :hover" (which is different from ".card:hover"), inside calc() and in strings.

What does "Merge and shorten rules" do?

It combines rules with the same selector and shortens values, for example margin: 0 0 0 0 to margin: 0 and #333333 to #333. Turn it off if you only want whitespace and comments removed.

What are license comments?

Comments that start with /*! are meant to stay in the minified file, usually for copyright or license notices. Keep them on unless you are sure you may remove them.

Can I minify SCSS or Less?

Minifying expects plain CSS, so compile SCSS or Less to CSS first. Beautify mode can format SCSS and Less directly.

What does the gzipped size mean?

Most web servers compress files with gzip before sending them, so the gzipped size is close to what visitors actually download.

Was this tool helpful?

More in this category