CSS Minifier
The CSS Minifier is a free online tool that compresses stylesheets to reduce file size. It strips comments, collapses whitespace, removes trailing semicolons, optimizes zero values, and shortens hex colors — turning bloated development CSS into lean, production-ready code that downloads and parses faster.
Why Minify CSS
Faster Page Loads
Lower Bandwidth
Production Ready
How to Minify CSS
Paste or Upload Your CSS
Type or paste your stylesheet into the input panel on the left, or use Upload to load a .css file directly. Try the Sample button to see how it works.
Set the Comment Option
Toggle Remove comments on to strip every /* ... */ block, or off if you need to keep license headers and notes.
Minify
Click Minify or press Ctrl + Enter. The compressed CSS appears instantly in the output panel.
Review & Export
Check the stats bar for original size, minified size, and savings. Then Copy the result to your clipboard or Download it as a file.
Optimizations & Features
What Gets Optimized
The minifier applies safe, well-established transformations that shrink your CSS without changing how it renders.
| Optimization | Before | After |
|---|---|---|
| Strip comments | /* header */ | (removed) |
| Collapse whitespace | margin: 0 auto; | margin:0 auto |
| Trailing semicolons | color:red;} | color:red} |
| Zero values | padding: 0px; | padding:0 |
| Shorten hex colors | #ffffff | #fff |
Built to Stay Valid
Preserves calc() Expressions
Spaces around operators inside calc() are required by the spec. The minifier protects them so your math keeps working.
Comment Toggle
Keep or strip /* */ comments with a single switch — handy for retaining license banners.
Compression Stats
See original size, minified size, and the percentage saved after every run.
Upload or Paste
Load a .css file from disk or paste code directly — whichever fits your workflow.
Frequently Asked Questions
Is my code sent to a server?
No. All minification happens locally in your browser using JavaScript. Your CSS is never uploaded, logged, or stored anywhere.
Will minification break my CSS?
No. The minifier only removes unnecessary characters — whitespace, comments, redundant semicolons — and safely shortens values. It protects calc() expressions and leaves media queries and selectors untouched, so the rendered result is identical.
How much file size reduction can I expect?
Typical stylesheets shrink by 30–60%, depending on how many comments and how much whitespace the original contains. Heavily documented or generously formatted CSS sees the largest savings.
Should I keep an unminified version?
Yes. Minified CSS is hard to read and edit, so always keep your original, formatted source for development. Minify only the copy you deploy to production.
Does it remove license comments?
If Remove comments is on, all /* */ comments are stripped, including license headers. Turn the option off when you need to preserve attribution or legal notices.
No comments yet. Be the first to comment!