Minify CSS: free online CSS minifier
Paste a stylesheet and get a compact, production-ready version as you type, with the exact byte savings. Licence comments, strings and calc() expressions stay intact.
Runs in your browser. Nothing you enter is uploaded.
url(), calc() spacing and /*! licence */ comments intact.
How to use the CSS minifier
- Paste your stylesheet into the CSS box, or click Example to load a sample.
- The minified version appears on the right as you type, with the size before and after.
- Click Copy to put the result on your clipboard, or Download .min.css to save it as a file.
- Keep your original, readable CSS for editing and ship the minified file to production.
What does minifying CSS remove?
Minifying removes everything a browser does not need: comments, line breaks, indentation, the spaces around braces, colons, commas and the >, + and ~ combinators, the last semicolon in each rule, and empty rules. A rule like a { color : red ; } becomes a{color:red}. The styles behave exactly the same; only the file gets smaller.
Some spaces must stay. Inside calc(), the + and - operators need whitespace on both sides, so calc(100% - 2 * 10px) is kept as written. Strings such as content: "x ; {y}" and the contents of url() are copied byte for byte, and comments that start with /*! are kept because they usually carry licence text.
How much smaller will my CSS get?
It depends on how the file is written. Stylesheets with many comments and generous indentation shrink the most; already compact CSS shrinks less. The example in the tool goes from 521 B to 405 B, about 22 percent smaller, and the counter under the boxes shows the exact saving for your own file.
Minifying works together with the gzip or Brotli compression most web servers apply. Compression shrinks repeated text very well, but it cannot remove comments and whitespace for you, so a minified and compressed file is still smaller than a compressed original. Both steps together give visitors the fastest download.
When should I minify CSS?
Minify the copy you publish, not the copy you edit. Keep your readable source in version control, and generate the .min.css file when you deploy or release. If you use a build tool, it can run a minifier on every build; this page is handy for quick jobs, checking a snippet, or projects without a build step.
Frequently asked questions
Is it safe to minify CSS?
Yes, as long as the minifier understands CSS syntax. This tool reads your stylesheet token by token, so it never touches strings, url() contents or the spaces calc() needs. It does not rename, reorder or merge rules. Still, keep your original file, because minified CSS is hard to edit by hand.
Does the minifier keep licence comments?
Yes. Comments that start with /*! are kept exactly as written, which is the usual convention for licence and copyright notices. All other comments are removed.
Can I minify CSS with media queries and custom properties?
Yes. Media queries keep the spaces between their keywords, so @media (min-width: 768px) and (max-width: 1199px) becomes @media (min-width:768px) and (max-width:1199px). Custom properties such as --brand: #4f46e5 become --brand:#4f46e5 and keep working with var().
Does this tool remove unused CSS?
No. It only removes empty rules, which never style anything. Finding selectors that your pages never use requires scanning your HTML and scripts, which needs a separate tool such as PurgeCSS in your build process.
Is my CSS uploaded anywhere?
No. The minifier runs entirely in your browser, so your stylesheet never leaves your device. The tool remembers your last input in your browser's local storage so it is still there when you come back; clearing your site data removes it.