Minify your CSS instantly with our free CSS Minifier. This tool removes comments, whitespace, line breaks, and unnecessary separators from your stylesheets to shrink their size and speed up page loads. It is ideal for optimizing websites and web apps for production. Simply paste your CSS and get the minified version in seconds, with live before-and-after size statistics.
Minification (also called CSS compression) strips characters the browser ignores anyway, so the page renders identically while the stylesheet downloads and parses faster. It is different from gzip or Brotli compression, which your web server applies on top — and the two stack for the smallest transfer size. To make minified CSS readable again, use the CSS Beautifier.
Everything runs in real time and entirely in your browser — there is no signup, no upload, and your stylesheets never leave your device. Paste compact or messy CSS and watch the minified output update as you type.
Here is a small stylesheet before and after minification. The styles are identical — only the comments, indentation, and extra spacing are removed:
/* Button styles */
.btn {
display: inline-block;
padding: 10px 20px;
background-color: #007bff;
color: #ffffff;
}.btn{display:inline-block;padding:10px 20px;background-color:#007bff;color:#ffffff}.css file for your build. /* ... */ comments, line breaks, and indentation that the browser does not need.{ }:; and ,.content text, and URLs are never mangled..css file.<head> for a faster first paint. CSS minification removes characters a browser does not need to interpret a stylesheet: comments, runs of whitespace, indentation, and the optional semicolons and spaces around declarations. Because browsers ignore these, the rendered result is unchanged — but the file is smaller, so it transfers over the network faster and parses more quickly. That is why production builds of almost every framework run a CSS minifier (like cssnano or clean-css) automatically as part of the bundling step.
Minification is not the same as gzip or Brotli compression. Minification shrinks the source text; the server then compresses the minified result further over the wire. Applying both gives the smallest payload. A safe minifier never removes characters that are significant: it preserves the spaces inside values like margin: 0 auto or border: 1px solid red, and it keeps the content of quoted strings intact so font-family lists, content properties, and url() references survive unchanged.
A typical CSS minifier targets four kinds of dispensable text:
/* ... */ blocks carry no meaning to the browser and are stripped entirely.; before a closing } is optional and removed.{ }:;, and combinators are dropped.Minification and beautification are opposites: the CSS Beautifier re-adds indentation to minified CSS so a human can read it, while the minifier does the reverse for performance. Neither is the same as gzip, which compresses bytes on the wire and is undone by the browser. For the markup side of a page you can apply the same idea with the HTML Minifier, and for data payloads use the JSON Minifier. Stack minification with server-side compression for the smallest possible transfer size.
a :hover (any hovered descendant of a) can collapse to a:hover (a when hovered) when spaces around : are removed. If the distinction matters, write the combinator explicitly or minify that rule by hand. margin: 0 auto stays intact). If a minifier ever merges them, the layout can break — use one that guards quoted strings and value whitespace. /* ... */ comments. If you need a license header or a comment to survive, keep an un-minified source copy and re-add it after minifying. Pair this minifier with its counterpart and the rest of our formatting and compression utilities: