CSS Minifier

Minify CSS by removing comments, whitespace and the last semicolon in each rule, with the size saved shown. Keeps values as written. Free, in your browser.

Input
Result

About CSS Minifier

The CSS Minifier shrinks a stylesheet by removing comments, spaces and line breaks, so it downloads faster. Paste your CSS and copy the smaller version.

How much will you save?

About a quarter is typical for readable CSS with indentation and comments. Already compact CSS shrinks less.

Values kept as written

Colours, units and values are not rewritten, so nothing changes in how your page looks.

No syntax check

Broken CSS is not reported. Make sure your stylesheet works before minifying.

Keep the original

Edit the readable version and minify again when you change it.

Private

Everything runs in your browser. Your code and data are not uploaded.

Example

.btn { color: #ffffff; margin: 0 auto; } becomes .btn{color:#ffffff;margin:0 auto}.

How to use CSS Minifier

  1. Paste your CSS or open a file.
  2. Review the minified output and the size saving.
  3. Copy it or download it.
  4. Upload the minified file to your site and keep the original for editing.

Related guide: Speed Up Your Website: Minify CSS, JavaScript and HTML

Help & FAQ

What does the CSS Minifier do?

It removes comments, white space and line breaks from CSS and shows how many bytes were saved.

How much smaller will our CSS be?

In the test a sample went from 181 B to 135 B, 25 percent. The saving depends on your formatting and comments.

Does it shorten colours like #FF0000?

No. In the test the colour value stayed as written. The tool removes comments and unnecessary white space, and drops the optional last semicolon before a closing brace.

Does it change 0px to 0?

No. 0px 0px 0px 0px stayed unchanged, so the values are exactly what you typed.

Are spaces inside quoted strings kept?

Yes. content:"a b" kept both spaces.

Does it check for CSS errors?

No. A broken rule was passed through without a message, so use a browser or linter to validate.

Does it remove the last semicolon in a rule?

Yes. The semicolon before a closing brace is dropped, which is safe in CSS.

Are media queries kept?

Yes. The @media rule was kept with its condition and its inner rule, with spaces removed.

Should we minify and also use gzip?

Yes. They work together, and gzip or Brotli on the server usually saves more than minifying.

How do we read minified CSS again?

Use the CSS Formatter to put every rule and declaration on its own line.

Can it open a file?

Yes. Use the Open .txt file button or paste the CSS.

Is our CSS uploaded?

No. It is minified in your browser.

More in Developer Tools

See all 39 in Developer Tools