CSS Minifier

Compress CSS by removing comments, whitespace and unnecessary characters. Shorten colors and numbers safely, see exactly how many bytes you save, and download the minified file.

  • Safe value shortening
  • Gzip size estimate
  • Runs in your browser
–Original
–Minified
–Saved
–Minified + gzip

How to use the CSS Minifier tool

  1. Paste or open your CSSPaste your stylesheet, or click “Open file” to load a .css file.
  2. Choose optionsShorten values, remove empty rules, and keep or drop /*! license */ comments.
  3. See the savingsThe minified CSS appears instantly with original, minified and gzip sizes.
  4. Copy or downloadCopy the result or download it as .min.css for your website.

What it does

  • Removes comments and whitespaceStrips indentation, line breaks and comments that browsers don’t need.
  • Shortens values safely0.50em → .5em, 0px → 0, #ffffff → #fff, without touching selectors, strings or custom properties.
  • Keeps what mattersStrings, url() values, calc() expressions and license comments are preserved exactly.
  • Removes empty rulesDrops selectors with no declarations, including inside media queries.
  • Shows real savingsCompare sizes before and after, including the gzip size your server will actually send.

Why minify CSS?

CSS is a render-blocking resource: the browser must download and parse it before it can show the page. Smaller stylesheets download and parse faster, improving metrics like First Contentful Paint and Largest Contentful Paint that affect both user experience and Google’s Core Web Vitals. Minification typically shrinks hand-written CSS by 20–40%.

Example

Before:

.card {
    margin : 0px auto ;
    color : #FFFFFF ;
    padding: 0.50em 1.0em;
}

After:

.card{margin:0 auto;color:#FFF;padding:.5em 1em}

What is changed, and what isn’t

ChangedNever changed
Comments (except /*! … */)Selectors, including spaces that change their meaning, like a :hover
Indentation, line breaks, extra spacesText inside quotes, such as content values
Last semicolon in each blockurl() values and data URIs
Leading and trailing zeros, zero unitsCustom properties (--variables) and calc() spacing
Six-digit colors that can be three digitsThe order of your rules

Minify and compress

Minification and server compression work together. Gzip or Brotli on your server reduce the transfer size much further, which is why the tool also shows the gzipped size. Always keep your original, readable CSS for editing, and serve the minified version on your live site. Most build tools (Vite, webpack, Laravel Mix) can minify automatically; this tool is ideal for quick jobs, WordPress themes and static sites.

Also minify your markup with the HTML Minifier and your scripts with the JavaScript Minifier.

Frequently asked questions

What does a CSS minifier do?
It removes comments, spaces and line breaks and shortens values, making the file smaller without changing how the page looks.
Is minified CSS safe to use?
Yes. This minifier only makes changes that don’t affect rendering. Keep your original file for future edits.
How much smaller will my CSS be?
Usually 20–40% for hand-written CSS. The tool shows the exact saving, plus the gzip size.
Will it keep my license comments?
Yes. Comments that start with /*! are kept by default, as is common for licenses.
Is my code uploaded?
No. Minification happens in your browser and your code never leaves your device.