How to use the CSS Formatter
- Paste CSS, SCSS or Less, or open a stylesheet.
- Choose Beautify for readable code or Minify for production.
- Copy or download the result.
Beautify
Beautifying uses Prettier to put one declaration per line, normalise spacing and indentation, and format nested SCSS/Less rules — handy for reading minified third-party CSS or tidying hand-written styles.
Minify
Minifying removes comments and every whitespace character that doesn't affect meaning. It's deliberately conservative: spaces inside calc(), before pseudo-classes in descendant selectors, and inside strings and url() are kept. It doesn't merge rules or shorten colours, so the result is always equivalent to your input.
Example
Minified CSS from a website, which is hard to read:
.btn{padding:8px 16px;border-radius:6px}.btn:hover{background:#0d7a63;color:#fff}After Beautify:
.btn {
padding: 8px 16px;
border-radius: 6px;
}
.btn:hover {
background: #0d7a63;
color: #fff;
}Minify does the reverse, which is what you want before putting hand-written CSS on a live site: fewer bytes for every visitor to download.
Frequently asked questions
Is my code sent anywhere?
No. Formatting and minifying run in your browser, so private stylesheets stay on your device.
Can I open a file?
Yes. Open a .css, .scss or .less file, or paste the code directly.
Why does minify fail on invalid CSS?
The stylesheet is parsed before minifying so broken CSS is reported instead of silently producing broken output.
Should I minify SCSS?
Browsers can't read SCSS — compile it to CSS first, then minify the CSS.