Skip to content
Tooletto

CSS Minifier

Minify CSS using csso — a minifier that parses your stylesheet into a real syntax tree rather than stripping characters, so it can safely merge duplicate rules and shorten values. Runs entirely in your browser.

  • Files never leave your device
  • Free, no signup
  • No watermarks
  • Works offline once loaded
Loading tool…

How to css minifier

  1. 1

    Paste your CSS

    Drop in a stylesheet, a snippet, or a single rule block.

  2. 2

    Leave restructuring on for the smallest output

    It merges duplicate and overlapping rules. Turn it off if the result ever surprises you.

  3. 3

    Copy the result

    Copy the minified CSS, along with the size saved.

What CSS minification actually removes and changes

Removing whitespace and comments is the obvious, easy part of minification — every minifier does that, and on its own it is barely more than a find-and-replace pass. The part that separates a real CSS-aware minifier from naive whitespace stripping is everything that requires actually understanding the stylesheet: shorthand value compression, where a color written as `#ffffff` becomes `#fff` and redundant zero units get trimmed, and duplicate or overlapping rule merging, where two rules that end up applying the same declarations get combined into one. Both require parsing the CSS into a real structure first — knowing which selector applies to which declarations, and which values are equivalent — which is why csso builds an actual syntax tree rather than pattern-matching text, the same reason a real parser earns its keep over a regex pass.

Why an ad hoc single-file minify still comes up

Modern build tools minify their CSS output automatically as part of a production build, so for anyone working inside a bundled project, minification already happens invisibly every time they build. A standalone tool like this one covers what falls outside that pipeline: a CMS or platform with no build step at all, a quick one-off snippet that needs to fit somewhere size-constrained, or just checking how much a given stylesheet would actually shrink before deciding whether wiring up tooling is worth it. For a single file needed once, pasting it here and copying the result back out is the faster path to the same output a bundler would produce.

What stays untouched

A CSS-aware minifier is deliberately conservative about what it will merge or rewrite: custom properties (CSS variables), media queries, keyframe animations and vendor-prefixed declarations are all preserved exactly as written, because collapsing them incorrectly could silently change how a page renders on some browsers or screen sizes rather than just how the source looks. The optimisations that are safe to make automatically — whitespace, comments, shorthand values, genuinely duplicate rules — are the ones with no possible effect on the rendered page, which is the whole design principle behind using a real parser instead of a blunter, riskier find-and-replace approach.

Frequently asked questions

Is my stylesheet sent to a server?

No. csso is downloaded to your browser and runs there — minification happens entirely on your device. Your CSS never travels over the network at any point.

Can minifying break my styles?

Generally no, when done correctly — csso parses your CSS into a real syntax tree rather than just stripping characters, which is exactly why it can safely do things like merge duplicate selectors or shorten values without changing which declaration wins in the cascade. The one place it can occasionally surprise you is its structural restructuring: merging rules across a stylesheet is a more aggressive optimisation than plain whitespace removal, and in rare edge cases with specificity-sensitive CSS it can produce output that looks different than expected. That is exactly why the "merge and restructure rules" option exists — turn it off and you get comments and whitespace removed only, with no structural changes at all.

Is minified CSS still valid, usable CSS?

Yes. The output is ordinary CSS — just unreadable to a human, which is the whole point for production. A browser parses it exactly the same as the formatted original; you can drop it straight into a `<link>` tag or a build output.

When should I actually use this?

For a production stylesheet, CSS embedded somewhere size-constrained (an inline `<style>` block, an email template, a platform with a character limit), or a one-off file you need shrunk quickly without wiring up a build step. You would not minify your source or development stylesheets — keep those readable, and minify only the final build output, the same way a bundler would.

Why does the output look unreadable?

That is the point. Whitespace and comments exist for humans reading the source, not for the browser rendering it. Stripping them, and safely merging what can be merged, reduces the number of bytes sent over the network without changing how the page looks.