go-supertools
Developer & Data Tools

CSS Minifier

Minify CSS Code

Runs in your browser Your input never leaves your device.

0 characters | 0 words

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

  1. Paste your CSS into the input box.
  2. Copy the minified result.
  3. Save it as a .min.css file and test your pages.
  4. Keep the original file for editing.

Example

Input
a {
  color: red;
  margin: 0 auto;
}
/* note */
.b > p { padding: 1px 2px; }
Result
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.