CSS Minifier & Beautifier
Developer ToolsMinify CSS for production or beautify minified CSS so you can read and edit it.
Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy
About
What the CSS Minifier does
The CSS Minifier shrinks stylesheets with CSSO: it removes whitespace and comments, shortens colors and values such as #ffffff to #fff and 0px to 0, and can merge rules that share declarations. License comments written /*! … */ are kept. The Beautify tab re-indents minified CSS with one declaration per line. The status line shows the sizes and a gzip estimate.
Steps
How to use it
- 1Choose Minify or Beautify.
- 2Paste the CSS or upload a .css file.
- 3Press the button and copy or download the result.
Example
A real run
Input
/* Primary button */
.button {
display: inline-block;
padding: 10px 16px 10px 16px;
color: #ffffff;
background-color: #6d28d9;
border: 0px solid transparent;
border-radius: 8px;
}
.button:hover {
background-color: #5b21b6;
color: #ffffff;
}Output
.button{display:inline-block;padding:10px 16px;color:#fff;background-color:#6d28d9;border:0 solid transparent;border-radius:8px}.button:hover{background-color:#5b21b6;color:#fff}
257 B → 178 B · 30.7% smallerThe padding shorthand collapses to two values, #ffffff becomes #fff, 0px becomes 0 and the comment is removed; each rule keeps its own selector.
Options
Every setting, and when to use it
- Merge rules and shorten values
- Lets CSSO combine selectors with identical declarations and merge shorthand properties, the largest savings after whitespace. Turn it off for a safer, whitespace-only minify when rule order matters in unusual ways.
- Keep /*! comments */
- Comments starting with /*! usually hold license notices that must stay with the code; other comments are removed.
- Beautify: indent and one selector per line
- Restores readable formatting with your indent. One selector per line puts each selector of a list such as .a, .b on its own line.
Good to know
Common problems and limits
Up to 5 MB. Unbalanced braces are reported with their line before minifying; other invalid CSS is passed through as written.
Restructuring never moves rules across media queries or changes which rule wins; still, test a stylesheet after minifying.
To convert px values to rem, use PX to REM; for JavaScript use the JavaScript Minifier.
Audience
Who uses it
- Front-end developersShrink a stylesheet for a static page, a theme or an email template without setting up a build.
- WordPress and CMS usersMinify custom CSS before pasting it into a theme's Additional CSS box.
- Developers maintaining old sitesBeautify a minified stylesheet found on a server so it can be edited.
FAQ
Frequently asked
How do I unminify CSS?
Paste it into the Beautify tab: each rule and declaration goes on its own line with consistent indentation. Unlike JavaScript, CSS keeps all its names when minified, so the beautified stylesheet is fully readable.
Does minifying CSS help page speed?
Yes, a little on its own and more combined with compression: smaller stylesheets download and parse faster, and CSS blocks rendering until it loads. Most of the transfer saving comes from gzip or Brotli on the server; minifying adds to it.
What does CSSO change besides whitespace?
It shortens colors (#ffffff to #fff, or a name when shorter), drops units from zero values, merges duplicate selectors and declarations, and combines longhand properties into shorthands where that is equivalent.
How do build tools minify CSS?
Vite uses esbuild or Lightning CSS, webpack setups often use cssnano through PostCSS, and frameworks such as Next.js minify CSS in production builds automatically. This page is for stylesheets outside a build.
Will minifying remove my license comment?
Not if it starts with /*!, the usual convention for comments that must be preserved. Keep /*! comments */ is on by default; all other comments are removed.
Is my CSS sent anywhere?
No. Minifying and beautifying happen in your browser. A copy of each run is saved to your past runs so you can reopen it.
Automation: an MCP tool minify_css(css), beautify_css(css) and an n8n node are planned for this tool.