CSS Minifier
Paste your CSS below to strip comments and collapse whitespace into a compact, production-ready file. The tool shows you the original size, minified size, and savings — all without sending your code anywhere.
What Is CSS Minification?
CSS minification is the process of removing everything from a stylesheet that is not needed for the browser to correctly interpret it: comments, line breaks, extra spaces, and indentation. The minified output is functionally identical to the original but significantly smaller, which means the browser downloads and parses it faster.
For a typical project stylesheet the savings range from 20% to 50%. For larger frameworks or libraries the absolute byte reduction can be substantial — faster page loads, better Core Web Vitals scores, and reduced bandwidth costs, especially for high-traffic sites.
How to Use This Tool
- Paste your CSS (or an entire stylesheet) into the Input CSS panel.
- Click Minify CSS.
- The minified result appears in the Minified Output panel along with a size comparison.
- Click Copy Output to copy the result to your clipboard, then paste it into your project.
What This Minifier Does
-
Removes comments — all
/* … */block comments are stripped, including multi-line ones. - Collapses whitespace — consecutive spaces, tabs, and newlines are replaced with a single space.
-
Removes spaces around structural characters — spaces before and after
{,},:,;, and,are eliminated. - Removes trailing semicolons — the last semicolon before a closing brace is redundant and is removed.
-
Preserves quoted strings — values inside
" "or' '(such ascontent:property values and font names) are not altered.
Limitations to Be Aware Of
This is a whitespace-based minifier — it does not perform deeper optimizations such as merging duplicate selectors, shortening color values (#ffffff → #fff), or converting margin: 10px 10px 10px 10px to margin: 10px. For those optimizations, consider a build-tool plugin like cssnano or clean-css in your CI pipeline. This tool is ideal for a quick manual minification or for validating what a minifier does to your CSS. For similar treatment of your markup, the XML Formatter can minify XML and HTML-like structures, and the JSON Minifier handles JSON payloads.
Frequently Asked Questions
Will minifying my CSS break anything?
Not if your CSS is valid. The minifier only removes whitespace and comments, which have no semantic effect. Your selectors, property names, and values remain unchanged. The one edge case to watch for is any CSS that relies on @charset rules — these must appear at the very start of the file, and most minifiers (including this one) preserve that.
Should I minify CSS in development or only in production?
Always minify for production deployments; never minify your source files directly. Keep the human-readable source in version control and add a build step (using a task runner, bundler, or CI pipeline) to produce the minified output automatically. Debugging minified CSS in browser DevTools is frustrating — most tools offer a "source maps" option to map minified output back to the original lines.
How much smaller will my CSS be?
It depends on how verbose your original CSS is. Stylesheets with many comments and generous whitespace can shrink 40–50%. Stylesheets that are already tightly written may only shrink 10–20%. The stats bar above the output shows you the exact byte savings after each minification.
Can I minify a CSS framework like Bootstrap or Tailwind?
You can, but for large frameworks the textarea may become slow. More importantly, frameworks like Bootstrap ship pre-minified distribution files already — you should use those directly. For Tailwind CSS, the framework uses PurgeCSS/tree-shaking to eliminate unused classes at build time, making further minification the last step of an already lean output.
Does this work on SCSS or Less?
No — this tool operates on plain compiled CSS. SCSS and Less are pre-processor languages that must be compiled to CSS first. Compile your SCSS/Less to CSS, then run it through this minifier if your build process doesn't handle minification automatically.