CSS Minifier

Minify CSS in your browser: comments removed, whitespace collapsed, last semicolons dropped, strings and url() values left exactly as written.

Enable JavaScript to customise; default output below.

Nothing is uploaded. The stylesheet stays in this tab.

More options Show
Live preview style.min.css
/*! Theme v1 */ .card{color:#1e56ec;padding:1rem 2rem}

Output is valid and updates as you type.

Paste a stylesheet and get it back minified: comments gone, whitespace collapsed, the final semicolon in each block dropped. Strings and url() values are left exactly as written.

How to use

  1. Paste the CSS. It stays in the browser tab, which matters when the stylesheet is not public yet.
  2. Keep /*! comments on. That is the convention for a licence header, and stripping one can breach the licence of the code you are minifying.
  3. Turn on one rule per line if the file goes into version control. It is a few bytes larger and vastly easier to diff.
  4. Copy the result, or download it as a .min.css.
  5. Minify the build output, not the source. Keep the readable file as the one you edit.

Example

/*! Theme v1 */
.card {
  color: #1e56ec;
  padding: 1rem 2rem;
}

becomes

/*! Theme v1 */ .card{color:#1e56ec;padding:1rem 2rem}

The space inside 1rem 2rem stays, because it separates two values. The space around { does not, because nothing depends on it.

Pitfalls

  • A minifier built on regular expressions breaks the first time a ; or a } appears inside a content string. This one scans character by character for that reason.
  • A space before a colon is meaningful in a selector: .a :hover and .a:hover are different rules. Whitespace before a colon is preserved here.
  • Unquoted url() values can contain spaces and brackets. They are copied through untouched.
  • Minified CSS still compresses. Gzip or Brotli does most of the work, so the gain over a well written file is smaller than it looks.
  • Minifying by hand and keeping only the minified file makes the stylesheet unmaintainable. Keep the source.
  • A stylesheet with a syntax error does not get fixed by minifying. Unterminated strings and comments are reported here rather than silently mangled.
  • /*! */ comments are kept by convention, not by the CSS specification. Anything that strips comments generically will still remove them.
  • Concatenating minified files without a newline between them is safe in CSS, but a missing final } in one file swallows the next.

Compatibility

The output is ordinary CSS and works anywhere the input did. Nothing is rewritten: colours, units and shorthand are left as you wrote them, so a value your target browser understands stays understood. The tool runs entirely in your browser and handles stylesheets up to 100,000 characters.

Frequently asked questions

How much smaller will my CSS get?
Usually 10 to 30 percent before compression, and much less after gzip. Whitespace compresses extremely well.
Does it rewrite colours or shorthand?
No. It removes what does not matter and leaves every value exactly as written, which is the safe half of what a build tool does.
Is it safe with content strings?
Yes. Strings are copied through untouched, including any braces or semicolons inside them.
Should I minify my WordPress theme’s style.css?
Not the one carrying the theme header. Minify the enqueued stylesheets and leave the header comment intact.
What about source maps?
This tool does not produce one. If you need mapping back to the source, minify as part of your build instead.
Weekly drops

New tools, when there are new tools

One email when something worth using ships. No schedule to fill, so no filler.

Your address goes nowhere else, and one click unsubscribes.