CSS Minifier
Minify CSS Code
Runs in your browser Your input never leaves your device.
About this tool
Shrinks CSS by removing what browsers do not need. It deletes comments, collapses runs of whitespace into a single space, strips spaces around { } ; , and around the > ~ + combinators, removes the space after a colon, and drops the last semicolon before a closing brace. Inside parentheses, such as calc(), media queries and :not(), the spaces around + - > ~ are kept, so calc(100% - 10px + 2px) stays valid. Quoted strings are copied unchanged. It is a text-based pass, not a full CSS parser, so it does not merge rules, shorten colors or reorder anything. Always test the minified file. It runs in your browser, so your stylesheet is not uploaded.
How to use it
- Paste your CSS into the input box.
- Copy the minified result.
- Save it as a .min.css file and test your pages.
- Keep the original file for editing.
Example
a {
color: red;
margin: 0 auto;
}
/* note */
.b > p { padding: 1px 2px; }a{color:red;margin:0 auto}.b>p{padding:1px 2px}Common problems
- Spaces inside calc() are still there
- They are required: calc() needs spaces around + and -, so they are kept on purpose. Only spaces outside parentheses are removed.
- A space before a colon remains, such as margin :0
- Spaces before a colon are kept because in a selector (div :first-child) removing them would change its meaning. It is safe but not the smallest possible output.
- Output does not look much smaller
- Only whitespace and comments are removed. Use gzip or Brotli on your server for further savings.