CSS Minifier

Shrink CSS by removing comments and whitespace, leaving strings, url() values and calc() spacing intact, and see the size saved.

Processed on your device. Files are not uploaded

How to minify CSS

  1. Paste your CSS

    Paste or type it into the box, or press Try an example.

  2. Choose whether to keep license comments

    Comments that start with /*! are kept by default.

  3. Copy or download

    Save the output as a .min.css file for production.

Worked example

This is what CSS Minifier gives for its own sample values. Open the tool above and change anything to try your own.

CSS

/* page */
body {
  margin: 0;
  font: 16px/1.5 "Inter", sans-serif;
}

.card:hover,
.card:focus-visible {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
  width: calc(100% - 2rem);
}
Keep /*! license */ comments
Yes

Minified

body{margin:0;font:16px/1.5 "Inter",sans-serif}.card:hover,.card:focus-visible{background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.1);width:calc(100% - 2rem)}

About CSS Minifier

Make a stylesheet smaller by removing comments, whitespace and the last semicolon of each rule. Strings and url() values are left alone, and calc() keeps the spaces it needs.

FAQs

Will it break my CSS?

No. It does not change values or reorder rules.

Why are the spaces in calc() kept?

calc(1px + 2px) needs spaces around + and -, or the browser ignores it.

Can I make it readable again?

Use CSS Formatter & Minifier.

Related tools