CSS Minifier
Shrink a stylesheet by removing comments and whitespace, without breaking a single rule.
Minify CSS Online
Every byte of CSS has to be downloaded and parsed before the browser can render the page, so stylesheets are worth keeping small. Minifying removes everything the browser does not need: comments, indentation and optional whitespace. This page is the Code Formatter set to CSS with a sample minified for you.
What stays and what goes
| Before | After |
|---|---|
.card { margin : 0 auto ; } | .card{margin:0 auto} |
width: calc(100% - 32px); | width:calc(100% - 32px) |
a > b | a>b |
/* comment */ | removed |
The space inside calc() must stay, because 100%-32px is invalid CSS. The same goes for the space in 0 auto, which separates two values.
Minify, compress, or both?
Minifying and server compression stack. Gzip or Brotli on the server typically makes a CSS file 70 to 80% smaller, and minifying first saves a little more on top. If your build tool already minifies, you do not need this page for production; it is for the snippets that bypass the build: inline styles in emails, critical CSS pasted into a head, or a stylesheet on a site without a build step.
Related tools
To remove the rules a page never uses, which saves far more than minifying, use the Unused CSS Remover. For the scripts next to the stylesheet, use the JavaScript minifier.