tooldura

All tools

CSS Minifier

Minify CSS without rewriting your rules, or format it back to readable

Output Style

About CSS Minifier

The CSS Minifier strips the parts of a stylesheet the browser never needed: comments, indentation, the line breaks between rules and the last semicolon in every block. What it will not do is rewrite your CSS. Rules are never merged, declarations are never reordered or deduplicated, and shorthands are left alone, because the order of declarations is load-bearing in real stylesheets and a `display:-webkit-box` sitting above a `display:flex` is a fallback rather than a duplicate. Optionally it also collapses six-digit hex colors to three, trims pointless zeros off numbers and drops rules whose body is empty. The Beautify mode runs the same tokenizer in reverse, so a minified file you inherited comes back with one declaration per line and one selector per line.

FreeNo paywalls or tiers
No SignupNothing to create
InstantNo setup, no install
Any DeviceMobile, tablet, desktop

The guide behind this tool

Minifying CSS Saves Almost Nothing, Until You Delete the Comments

Three stylesheets measured as they would be served: stripping whitespace bought 3 to 5 percent, stripping comments bought up to 58. Why the gap is that wide.

8 min read

How to use CSS Minifier

  1. 1

    Paste your CSS into the left pane, or drop a .css file onto it.

  2. 2

    Leave it on Minify, or switch to Beautify if what you have is already compressed and you need to read it.

  3. 3

    Adjust the checkboxes if you want license comments dropped, colors left untouched, or empty rules kept.

  4. 4

    Read the size line above the output: original size, new size, and how much smaller it came out.

  5. 5

    Copy the result, or download it as a .min.css file next to your original.

Frequently Asked Questions

It is built so it cannot, by only ever removing whitespace and never adding any. Anything that had no space between it survives byte for byte, and the tokenizer treats strings, url() and comments as single units so a semicolon inside a data URI or a brace inside a content string is never read as structure. The spaces that genuinely carry meaning are kept: the one in `calc(100% - 20px)`, the one in `a :hover`, and the one in `screen and (min-width: 640px)`, all three of which are common ways a careless minifier corrupts a file.