Skip to content

CSS Minifier

Paste CSS and get comments and unnecessary whitespace stripped, with string content and url() left byte-exact and, deliberately, the spaces inside calc() expressions left alone — the CSS spec requires them around + and -, and a minifier that removes them produces CSS that silently stops working.

  • Strips comments and collapses whitespace
  • Never touches string literals or url() content
  • Preserves spaces inside calc(), which the spec requires
  • Runs fully client-side

Minifier

Processed locally, nothing uploaded

Minified

How to minify CSS

  1. 01

    Paste the CSS

    A full stylesheet or a single rule block both work.

  2. 02

    Copy the minified output

    Comments are gone, whitespace is collapsed, and string/url() content is untouched.

The calc() bug this tool deliberately avoids#

CSS's calc() function requires whitespace around a + or - operator — calc(100% - 32px) is valid, calc(100% -32px) is a syntax error, because the parser cannot tell whether that -32px is a subtraction or a negative length. A minifier that aggressively strips all whitespace around operators, including inside calc(), produces CSS that looks identical to a human skimming it but silently fails to parse in the browser. This tool specifically protects calc() expressions (and, more generally, anything inside parentheses reached through url() and quoted strings) from that kind of whitespace stripping.

Why some whitespace is left alone on purpose#

This tool removes spaces immediately around {, }, ;, , and : — always safe, since CSS syntax never depends on whitespace at those positions. It deliberately leaves spaces around combinators (>, +, ~) untouched rather than risk the ambiguity of stripping them in every context; the byte savings from that additional stripping are small, and getting it wrong even occasionally is a worse trade than a slightly larger file.

What never gets touched at all#

Content inside a quoted string (content: "a { b }") and inside url(...) is copied through byte-for-byte, including any characters that would otherwise look like CSS syntax — a brace, a colon, a comment-opening sequence. Minifying the inside of a string or URL would change what the CSS actually renders, not just how it is written.

Frequently asked questions

Does this minifier break calc() expressions?

No — calc() requires whitespace around + and - operators per the CSS spec, and stripping it produces a syntax error that silently fails in the browser. This tool specifically protects calc() and other parenthesized expressions from whitespace removal.

Why are spaces around > + ~ combinators left in place?

Removing them is usually safe, but not risk-free in every context, and the byte savings are small. This tool takes the conservative option rather than trade correctness for a marginal size reduction.

Does it touch the content inside quotes or url()?

No — string and url() content is preserved byte-for-byte, including characters that would otherwise look like CSS syntax, since minifying inside them would change what the CSS actually does.

Is my CSS sent anywhere?

No. Minification runs entirely in your browser — nothing is uploaded.

Developers

UUID Generator

Generate cryptographically random UUID v4 or time-ordered UUID v7, in bulk.

Developers

Base64 Encoder & Decoder

Encode and decode Base64 with correct UTF-8 handling, including the URL-safe alphabet.

Developers

ULID Generator

Generate ULIDs — sortable by creation time like UUID v7, but Crockford Base32 instead of hex.