CSS Minifier

Minify CSS by stripping comments and collapsing whitespace, with string and url() contents preserved. See the byte savings live. Runs entirely in your browser.

Minified 222160 bytes (27.9% smaller)

.card{display:flex;padding:1rem 1.5rem;border-radius:8px;background:#ffffff;box-shadow:0 1px 3px rgba(0,0,0,0.1)}.card>.title{font-size:1.25rem;font-weight:600}

Strips comments, collapses whitespace, removes spaces around structural symbols, and drops the final semicolon in each block. String literals (including url() and content values) are preserved exactly.

About this tool

CSS is full of whitespace and comments that the browser does not need, and removing them shrinks the file the browser must download and parse. This minifier strips all comments, collapses every run of whitespace, removes the spaces around structural characters like braces, colons, semicolons, commas, and combinators (so `a > b` becomes `a>b`), and drops the redundant final semicolon before each closing brace. It does all of this safely: string literals — including the contents of url() and content values — are protected before processing and restored untouched, so a declaration like content: 'a; b' is never corrupted. The output is equivalent CSS that renders identically but is meaningfully smaller, especially before gzip/brotli. It is the inverse of a pretty printer and a quick way to compress a stylesheet or a snippet without setting up a build step. Everything runs locally in your browser.

How to use it

  • Paste your CSS.
  • Read the minified output and the percentage saved.
  • Copy it into your stylesheet or inline <style>.
  • For a build pipeline, a tool like cssnano integrates with your bundler; this is a fast standalone pass.

Frequently asked questions

Is the minified CSS equivalent to the original?
Yes. Only insignificant whitespace and comments are removed and structural spacing is tightened — none of which changes how the CSS applies. String and url() contents are preserved byte-for-byte, so the rendered result is identical.
Does it preserve url() and content values?
Yes. Quoted strings are protected before any whitespace processing, so spaces, semicolons, and other characters inside content: "…" or url("…") survive intact rather than being collapsed.
Why remove the last semicolon in a block?
The semicolon separates declarations, so the one before a closing } is optional. Dropping it is a safe, standard micro-optimization that shaves a byte per rule.
How much smaller will my CSS get?
It depends on how much whitespace and how many comments the source has — often 10–30% before compression. On the wire, gzip or brotli already compresses repeated whitespace well, so the post-compression win is smaller but still real for parse time.
Should I minify by hand or in my build?
For production, integrate a minifier (cssnano, esbuild, Lightning CSS) into your build so it runs automatically. Use this tool for one-off snippets, inline styles, or a quick check without tooling.
Is my CSS uploaded?
No. Minification runs entirely in your browser with no network request.

Related tools