CSS Minifier — Shrink Your Stylesheets

Strip comments and collapse whitespace from your CSS while preserving values, strings and custom properties. Watch the bytes disappear.

100%Free
0Signup Required
0Data Leaves Browser

CSS Minifier

Free • No Signup
Live — results update as you type
0 B input0 B output0% saved gzip estimate

Quick Answer

A CSS minifier removes comments and unnecessary whitespace from stylesheets, producing a smaller file that renders identically. This tool preserves every value — colors, strings, custom properties — and shows your exact byte savings live.

What This Tool Does

Comments and whitespace are stripped while strings, custom properties and values are preserved exactly. The tool is conservative about where spaces are required (for example between the parts of a value like 1rem auto), so the output behaves identically. Optional optimizations — shortening hex colors, shrinking zero units, removing the last semicolon and dropping empty rules — squeeze out even more bytes.

Key Features

  • Value-safecalc(), custom properties and quoted strings survive intact.
  • Comment removal — including multiline blocks.
  • Hex shortening#ffffff becomes #fff when the pairs repeat.
  • Unit optimization0px becomes 0, 0.5em becomes .5em.
  • Cleanup options — remove the last semicolon per rule and drop empty rules.
  • Live savings + gzip estimate — input, output, percentage, and an approximate gzipped size.
  • Upload file or load from URL — minify existing stylesheets directly.
  • Copy or download the minified stylesheet.

How to Use the CSS Minifier

  1. Paste your CSS into the input box, or use Upload File / Load from URL.
  2. Open Show advanced options and tick Shorten hex colors, Optimize units, Remove last semicolon or Remove empty rules for extra savings.
  3. Read the minified output and the size stats, including the gzip estimate.
  4. Copy it or download styles.min.css.

Use Cases

  • Shrinking a framework’s CSS for a quick inline style block.
  • Reducing payload for email templates or embedded widgets.
  • Measuring how much whitespace is costing you.

Tips

  • Pair with the CSS Beautifier when you need the readable version back.
  • For production, let your build tool minify automatically; use this for quick edits.

Privacy

Minification runs locally — your stylesheet never leaves the browser.

Conclusion

Trim the fat from your CSS in seconds, see exactly what you saved, and ship it.

FAQ

Frequently Asked Questions About CSS Minifier

No — only comments and whitespace are removed by default. Colors, values, custom properties and quoted strings are preserved exactly. Optional optimizations (hex shortening, unit shrinking, last-semicolon and empty-rule removal) are all opt-in.

Yes — paste the minified output into the CSS Beautifier to get readable, indented code back.

The output is valid, behavior-identical CSS. Still, test once after minifying — especially if you used unusual comment hacks.

Nowhere — everything is processed locally in your browser.

Yes. Turn on Shorten hex colors (#ffffff becomes #fff) and Optimize units (0px becomes 0, 0.5em becomes .5em) in the advanced options for extra savings.

Yes — use the Upload File button to read a local .css file, or paste a URL into the Load from URL field. Everything stays in your browser.

More Tools

Code Faster, Not Harder

Format, minify, test and generate — free developer utilities that run entirely in your browser.