CSS Minifier

Paste a stylesheet to shrink it instantly. You’ll see the original and minified size, the percentage saved and the gzipped size — and you can beautify it back at any time.

Runs in your browser
 
Minified CSS
 

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the CSS Minifier

  1. Paste your CSS, drop a .css file onto the input, or click Sample.
  2. Leave the optimisations on (all are safe) or untick any you don’t want.
  3. Check the savings below the editor, then Copy or Download styles.min.css.
  4. Need to read a minified file instead? Switch to Beautify.

What is CSS minification?

CSS minification removes every byte the browser doesn’t need — comments, indentation, line breaks, the last semicolon in each rule — and rewrites some values into shorter equivalents. The resulting stylesheet is functionally identical but smaller, so it downloads and parses faster. Because CSS is render-blocking, a smaller stylesheet can directly improve First Contentful Paint and Largest Contentful Paint.

What this minifier changes

OptimisationBeforeAfter
Comments & whitespace/* Buttons */ .btn , .link { … }.btn,.link{…}
Last semicolon{color:red;}{color:red}
Colours#FFFFFF, #aabbccdd#fff, #abcd
Zero unitsmargin:0px 0emmargin:0 0
Numbers0.50rem, 1.0.5rem, 1
Empty rules.unused{}(removed)

Why it is safe

Aggressive minifiers sometimes break stylesheets. This one only applies transformations that can’t change behaviour:

  • Strings, url() values and escaped characters are protected and never modified.
  • Units are only dropped on lengths — 0s, 0deg and 0% keep theirs (transition: 0s and keyframe selectors need them), and nothing inside calc(), min() or clamp() is touched because calc(0 + 10px) is invalid.
  • The flex shorthand is skipped (flex: 1 1 0px and flex: 1 1 0 are not always equal in older engines), and custom property values only lose redundant spaces.
  • Whitespace in selectors is kept where it means something: a :hover (any hovered descendant) differs from a:hover.
  • @layer name {} is kept even when empty, because it declares layer order. License comments starting with /*! are preserved by default.

Minification vs. compression

Minifying and gzip/Brotli compression stack. Compression removes repetition; minification removes bytes compression can’t, such as comments. The Gzipped output figure shows roughly what will travel over the network if your server compresses responses (most do). For the biggest win, also remove unused rules with a tool like PurgeCSS, and inline only the critical CSS for above-the-fold content.

Want to inspect a minified file? Use Beautify mode here or the CSS Formatter. Checking a whole page’s performance? Run a page speed test.

Tools that pair well with the CSS Minifier

  • HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.
  • JavaScript Formatter — Unminify and pretty-print JavaScript, JSON or JSX with your preferred indentation and brace style — or strip whitespace and comments with a verified minifier.
  • Image Compressor — Shrink photos and graphics by 50–90% without visible quality loss.
  • SQL Formatter — Paste a query — or a whole migration — and get readable SQL with one clause per line, aligned joins and consistent keyword case, using the grammar of your database.

Frequently asked questions

Can minifying break my CSS?
Not with these settings: every optimisation is limited to cases where the result is equivalent (for example units are only removed from zero lengths outside calc()). If your original CSS has a syntax error, the error stays in the output, so validate CSS that behaves strangely.
How much smaller will my CSS get?
Hand-written, commented CSS typically shrinks by 20–40%. Already-compact framework builds save less. The stats panel shows the exact saving and the gzipped size.
Should I still use gzip or Brotli?
Yes. Minification and HTTP compression complement each other: minify first, then let your server or CDN compress the file. Together they usually cut CSS transfer size by 80–90%.
Why are some comments kept?
Comments starting with /*! conventionally contain license notices that must stay with the code. Untick “Keep /*! license */ comments” to remove them too.
Does it remove unused CSS?
No. Finding unused selectors requires your HTML and JavaScript — use a tool like PurgeCSS or the Coverage tab in Chrome DevTools for that.
Is my stylesheet uploaded?
No, minification runs locally in your browser and nothing is sent to a server.

Related tools