100% local — your data never leaves your browser

CSS Minifier — Bytes Off Your Page Weight

Strip the whitespace from CSS. Strings, url() contents and /*! licence comments are kept, so the stylesheet gets lighter and still renders the same.

Instant Private Zero cookies

CSS input

CSS output

What this tool does

Readable CSS becomes the smallest CSS that behaves identically.

a {
  margin: 0 auto;
  color: red;
}
a{margin:0 auto;color:red}

The whitespace around the punctuation goes, the last semicolon before a closing brace goes, and the rest stays exactly as it was.

Licence comments stay

/*! normalize.css v8 | MIT License */
a { color: red }
/*! normalize.css v8 | MIT License */a{color:red}

A comment starting with /*! is the convention every minifier honours: it means “this one is not decoration”. That is where licence notices live, and a licence often requires them to travel with the code. They were being stripped along with the rest — a real defect, found while writing this page and fixed. Ordinary comments still go, because that is what you came for.

The spaces that mean something are kept

  • Inside strings. content: "a b" keeps both spaces: between quotes, whitespace is a value.
  • Inside url(). An unquoted URL can contain a space, a slash or a semicolon, and none of them is syntax there.
  • Around operators in calc(). calc(100% - 10px) without its spaces is not the same expression — it stops parsing.
  • Between selectors. a b is “a b inside an a”; a>b, a~b and a+b do not need the space, and lose it.

What it does not do

This is a whitespace minifier, and nothing else. It does not shorten colours, fold shorthand properties, drop units from zeros, merge duplicate rules or reorder anything. Those transformations belong to an optimiser such as cssnano or Lightning CSS, they each carry a risk, and none of them is the reason you pasted a stylesheet into a box on a web page.

The CSS formatter on this site is the reverse trip, for when you want to read the file again.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

Are my licence comments removed?
No, not since this page was written. `/*! … */` — a comment whose first character is an exclamation mark — is the universal convention for “keep this one”, and it is where licence notices live. They were being stripped with everything else, which quietly removed from the stylesheet the text saying who wrote it, and which a licence often requires you to keep. Ordinary `/* … */` comments still go.
Does it shorten my colours and values?
No. `#FFFFFF` stays `#FFFFFF` and `margin: 10px 10px 10px 10px` is not folded into `10px`. This is a whitespace minifier, not an optimiser: every one of those rewrites is a judgement about your stylesheet, and some of them change behaviour. What you get back is byte for byte your CSS, minus the space between the tokens.
Is it safe with `calc()` and descendant selectors?
Yes — the space that means something is kept. `calc(100% - 10px)` needs the spaces around the minus sign or it stops parsing, and `a b` is a descendant selector where `ab` would be an element. Spaces between words are preserved; the ones around `{`, `}`, `:`, `;` and `,` are what goes.

Related converters