CSS Whitespace Compressor

Remove CSS comments and extra spacing between rules. This compresses whitespace only — it does not shorten colors, merge rules, or optimize declarations like cssnano or clean-css.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about CSS

How to Compress CSS Whitespace

CSS Whitespace Compression

What This Tool Does

Removes CSS comments and insignificant whitespace between rules and declarations. Selectors, property names, and values are preserved. This is a whitespace compressor — not a production build minifier like cssnano or clean-css.

What It Does Not Do

  • Shorten colors (#ffffff stays as-is)
  • Merge duplicate rules or remove unused declarations
  • Optimize calc() or rewrite vendor prefixes
  • Fix invalid CSS — malformed input is rejected with an error

When to Use It

Quickly one-line a stylesheet before pasting into a snippet, email, or ticket. For production bundles, use your build pipeline minifier and measure gzip size separately — whitespace removal alone may have limited impact after compression.

Frequently asked questions

Is this the same as a production CSS minifier?

No. It only removes comments and extra spacing. Build tools also optimize values, merge rules, and apply other transformations.

Will compress rename class names?

No. Selectors and values are preserved; only whitespace and comments are removed.

What happens with invalid CSS?

The tool returns an error instead of silently producing corrupted output. Fix syntax issues first, then compress.