The CSS Minifier removes comments and unneeded whitespace from a stylesheet, producing a smaller file that downloads faster. Paste in your CSS, minify it in your browser and copy or download the result. It does not rewrite your values, and it keeps selectors like .a :hover, quoted strings and url() contents exactly as written.
Made for developers. Typical uses:
A 251-byte stylesheet with comments, two button rules, a data-URL background and a content string with two spaces minifies to 203 bytes, about 19% smaller. The two spaces inside the quoted string and the data URL are untouched, and .btn{color:#fff;padding:8px 16px} replaces the indented block.
It removes comments and whitespace only: it does not shorten colours, merge rules, remove unused CSS, add prefixes or create source maps. Servers usually gzip or Brotli-compress CSS anyway, so the saving over the network is smaller than the figure shown.
Accuracy: Output is tested to keep behaviour unchanged. Keep your original files and test the minified version before you deploy it.
Expert Tip
Edit the readable source and publish only the minified copy. If a build tool already minifies your CSS, use this tool for quick jobs and to see how much a file could shrink.
The CSS Minifier makes a stylesheet smaller by removing the parts that browsers do not need: comments, line breaks, indentation and the spaces around braces, colons and semicolons. You paste your CSS, press Minify, and see the size before and after, the percentage saved, and the result, which you can copy or download as minified.css. It never changes what a rule means. Everything runs in your browser, so the stylesheet is not uploaded.
Take a stylesheet of 251 bytes that contains a comment, two button rules, a rule with a selector that has a space before a pseudo-class, an icon background that uses a data URL, a content string with two spaces, and a licence comment. The minifier reduces it to 203 bytes, a saving of about 19 percent: the .btn rule becomes .btn{color:#fff;padding:8px 16px} and the hover rule follows it on the same line. The quoted content string "a b" keeps both of its spaces, the data URL is untouched, and the selector .a :hover keeps its space, because .a:hover and .a :hover mean different things. The licence comment survives at the end unless you turn the option off.
A careless minifier can break a page, so this one is conservative. It leaves quoted strings and the contents of url() exactly as written, keeps the space in descendant selectors, and preserves comments that begin with /! when "Keep /! licence */ comments" is on, which is how open-source licences are usually marked. It does not shorten colours such as #ffffff to #fff, merge rules, reorder properties or rewrite values like margin: 0 0 0 0. Those optimisations save a little more but can change behaviour in edge cases, so a build tool is the right place for them.
The saving depends on how much of the file is comments and indentation. A well-commented, nicely indented stylesheet can shrink by a quarter to a half. One that was already compact saves little. The figure shown is the raw size, but servers normally also compress CSS with gzip or Brotli, which already removes much of the repeated whitespace, so the difference over the network is smaller. Minification is still worthwhile because the browser also has less text to parse. The guide to minifying CSS, JavaScript and HTML explains where each step fits in a build.
Keep your readable source as the version you edit, and publish the minified copy. If you need to read a minified file again, the CSS Formatter restores indentation, although comments that were removed stay gone. Test the page after minifying, as with any change. Check that the stylesheet is valid first with the CSS Validator, because a minifier does not repair mistakes. For other files, use the JavaScript Minifier and HTML Minifier.
The tool minifies one pasted stylesheet at a time. It does not combine files, remove unused rules, add vendor prefixes or generate source maps. If your site uses a build tool such as a bundler, let it do the minifying automatically and use this tool for quick jobs, for checking how much a file would shrink, and for code that is not part of a build.
What minifying removes, how much it saves next to gzip and Brotli, and how to test minified CSS, JavaScript and HTML before you deploy it.
Explore more in Minifiers, read the guides and articles, or see how we test our tools.
Format and beautify messy CSS code with proper indentation.
Best for beautifying minified CSS for editing
Minify and compress JavaScript code to reduce file size.
Best for reducing JS file sizes for faster page loading
Minify and compress HTML code to reduce file size.
Best for shrinking a static landing page's HTML before deploying it
Validate CSS code for syntax errors and compliance with W3C standards.
Best for catching a missing semicolon or unclosed brace that's silently breaking a stylesheet
Convert between CSS units like px, em, rem, vw, vh, and percentages.
Best for converting a fixed px value from a Figma or Sketch mockup into rem for scalable, accessible typography