CSS Minifier
Strip comments and whitespace from CSS.
Results appear as you type
Everything runs locally in your browser โ your input never leaves this page.
About the CSS Minifier
The CSS Minifier strips comments, whitespace and line breaks from your stylesheet to produce a smaller, production-ready file. Smaller CSS means faster page loads and less bandwidth for your visitors. The minification runs locally in your browser, so your styles are never sent anywhere.
How to use
- Paste your CSS into the input box.
- Run the minifier to collapse whitespace and remove comments.
- Copy the minified CSS into your build or production stylesheet.
What minification can and cannot safely remove
CSS minification is safe because the language has a small set of places where whitespace carries no meaning. Between a selector and its opening brace, around a colon in a declaration, after a semicolon โ all of it can go. What cannot go is whitespace inside a value: `margin: 0 auto` has a descendant-free space that separates two values, and `.a .b` means something entirely different from `.a.b`. A minifier that treats those as noise silently changes your layout.
Comments are removed with one exception worth knowing about. The `/*! */` form is conventionally preserved by build tools because it is where licence headers live, and stripping it from a bundled third-party stylesheet can put you in breach of that licence. If you are minifying a file you did not write, check what the comment block says before deleting it.
Expect a smaller win than you might hope. Minification typically removes 10โ30% of a hand-written stylesheet, but almost all of that overlaps with what gzip or brotli already compress away on the wire โ repeated whitespace is exactly what a compression dictionary handles best. The real size wins in CSS come from deleting rules you no longer use, not from squeezing the ones you keep.
Frequently asked questions
- What does minifying CSS do?
- It removes comments, extra spaces and line breaks that browsers don't need, shrinking the file size without changing how the styles render.
- Will minifying change how my site looks?
- No. Only insignificant characters are removed, so the visual result of your stylesheet stays the same.
- Is my CSS uploaded to a server?
- No. The CSS is minified directly in your browser, keeping your code private.