DT Dev Tools

CSS Minifier

Minify and restructure CSS with CSSO in your browser. See the size before and after, then copy or download the .min.css file.

🔒 Runs entirely in your browser — nothing is uploaded

Drop a .css file here or click to browse — or paste CSS below

Before: –After: –Saved: –
Advertisement

What the CSS minifier does

This tool shrinks stylesheets with CSSO (CSS Optimizer), a minifier that understands CSS instead of treating it as plain text. In the first pass it performs safe cleanups: whitespace and comments are removed, colors are shortened (#ff0000 becomes red, #ffffff becomes #fff), zero values lose their units, redundant quotes and semicolons disappear and numbers are written in their shortest form. The result is exactly equivalent CSS that is noticeably smaller.

With restructure enabled, CSSO goes further and optimizes the structure of the stylesheet. Rules with the same selector are merged, selectors that share identical declarations are grouped, properties that are overridden later in the same rule are dropped, and longhand declarations such as separate margins can be collapsed into a shorthand. CSSO is careful to preserve the cascade: it only moves or merges rules when doing so cannot change which declaration wins.

Reading the results

The badges show the UTF-8 size of the input and output and the percentage saved. Hand-written CSS with comments and indentation often shrinks by 20–50%. Framework output that is already compact will gain less, while stylesheets that repeat the same declarations across many selectors benefit most from restructuring. Servers typically apply gzip or Brotli on top, so minification and compression complement each other rather than competing.

Private and safe to use

The minifier runs completely in your browser — nothing is uploaded, logged or stored. That makes it handy for inline critical CSS, email templates, embedded widgets or quick fixes on a machine without your usual build tools. Keep /*! ... */ comments if your stylesheet includes third-party licenses that must be retained. For production sites, add a minifier to your build so every deployment is optimized automatically, and always check the output visually when your CSS relies on browser hacks or unusual syntax.

How to use

  1. Add your CSSPaste a stylesheet or drop a .css file onto the drop zone.
  2. Choose optionsDecide whether to restructure rules and whether to keep /*! license */ comments.
  3. MinifyClick Minify CSS and check the size before, after and the percentage saved.
  4. Copy or downloadCopy the minified CSS or download it as a .min.css file.

Frequently asked questions

What does restructuring do?
CSSO merges rules with identical selectors or declarations, removes overridden properties and combines shorthand values. It usually saves more bytes than whitespace removal alone. Turn it off if you want the rule order and structure left exactly as written.
Can minification break my styles?
CSSO only applies transformations that keep the cascade equivalent, so well-formed CSS renders the same. Invalid or hack-heavy CSS can behave unexpectedly, so test the result in your target browsers.
Are license comments kept?
Comments starting with /*! are preserved when Keep /*! license */ comments is ticked. All other comments are removed.
Is my CSS uploaded?
No. CSSO is loaded as a script and runs in your browser, so the stylesheet never leaves your device.
Advertisement