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 bis “abinside ana”;a>b,a~banda+bdo 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.