Skip to content

CSS Minify

Minify and compact CSS.

Loading…

About CSS Minify

A lot of the weight in hand-written CSS is comments and indentation. Paste a stylesheet and the compact version appears at once: comments are dropped, whitespace shrinks to the spaces CSS actually needs, and empty declarations and the final semicolon in each block disappear. Quoted strings and url() contents are copied as they are, and operators inside calc() and media queries keep their spaces, so the rules mean the same thing as before. Nothing is rewritten beyond that.

Features

  • Removes comments, line breaks and surplus spaces
  • Drops empty declarations and the last semicolon before a closing brace
  • Keeps the spaces around operators in calc() and media queries
  • Quoted strings and url() values are left as written
  • Updates live while you type

Limitations

  • Whitespace and comments only: colors are not shortened, rules are not merged, unused selectors stay and files are not combined, so this is not a bundler or an optimizer.
  • The CSS is not validated, so typos and braces that do not pair up pass through unchanged.
  • The output is copy-only, because this page has no download button.

How it works

  1. Paste your CSS into the CSS Input panel.
  2. Watch the Minified CSS panel fill in as you type; there is no button to press.
  3. Select Copy Output and paste the result where you need it, or Clear All to start again.

Example input

.button {
  color: red; /* brand color */
  padding: 10px;
}

Frequently asked questions