CSS Formatter
Beautify CSS one declaration per line, or minify it safely.
Runs in your browser
Formatting and minifying CSS
Minified CSS from a website or a library is one long line that's almost impossible to read or debug. Paste it here and it's laid out again: one rule per block, one declaration per line, selector lists split up and media queries indented.
Going the other way, Minify removes comments, whitespace and anything else the browser doesn't need, like #ffffff written as #fff and 0px as 0. It only makes safe changes and never reorders or merges your rules, so the cascade works exactly as before. Comments starting with /*! (license notices) are kept.
How to use the CSS Formatter
Paste your CSS. Or load the sample stylesheet.
Choose Format or Minify. Format also lets you pick 2 spaces, 4 spaces or tabs.
Copy the result. When minifying, the status line shows how much smaller it got.
Tips
- Most build tools (Vite, webpack, Next.js) minify CSS for you; this is for quick one-off files, emails and checking what a minifier does.
- Formatting a library's minified CSS is a quick way to find which rule is overriding yours.
- Pair it with the CSS Gradient and Box Shadow generators, then paste their output here.
Frequently asked questions
Is minifying safe?
Yes. It removes whitespace and comments and shortens values (colors, zeros) but never moves or merges rules, which is what occasionally breaks more aggressive minifiers.
Does it work with SCSS or Less?
Formatting works for most SCSS and Less, since their syntax is close to CSS. Minifying is for plain CSS; compile SCSS or Less first.
Which comments are kept?
When formatting, all of them. When minifying, only /*! … */ comments, the usual way to mark license notices that must stay.
Is my CSS uploaded?
No. Formatting and minifying run in your browser.