Skip to content
Devtoolry

CSS Minifier

Minify CSS online: strip comments, whitespace and redundant semicolons to shrink your stylesheet, and see the bytes saved. Runs in your browser.

Runs in your browser · Nothing uploadedFree · No sign-up

Something not working, or missing a feature? Send feedback

About the CSS Minifier

The CSS Minifier removes comments, whitespace and redundant characters from stylesheets to cut download size without changing how pages look.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the CSS Minifier

  1. Paste CSS or open a file.
  2. Compare the original and minified size.
  3. Copy or download the minified CSS.

Example

Minify a button style

Input

/* Primary button */
.btn-primary {
  color: #ffffff;
  background-color: #2563eb;
  padding: 8px 16px;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

Result

.btn-primary{color:#ffffff;background-color:#2563eb;padding:8px 16px}.btn-primary:hover{background-color:#1d4ed8}

158 bytes become 113 (about 28% smaller). The comment, line breaks and the semicolon before each } are removed; the space in "8px 16px" stays because it separates two values.

Common mistakes

  • Editing the minified file. Keep the readable stylesheet as your source and minify it as a build step. Changes made to minified CSS are hard to review and easy to lose.
  • Spaces in calc(). calc(100% - 32px) needs the spaces around - and +. The minifier keeps them, so do not remove them by hand afterwards.
  • Comments you need. All comments are removed, including licence headers. Add required licence notices back at the top of the minified file.

Works well with the CSS Minifier

Frequently asked questions

Will minified CSS behave differently?

No. Only characters that do not affect the rules are removed.

Should I keep the original?

Yes. Edit the readable version and minify it again for production; minified CSS is hard to maintain.

How much smaller will my CSS get?

Typically 15 to 30 percent, depending on how many comments and how much indentation the file has. The tool shows the exact size before and after.

Is minifying the same as gzip?

No, they add up. Minify first, then let your server compress the file with gzip or Brotli for the smallest download.

Guides and tutorials