How to beautify and reindent CSS
Beautifying CSS takes a compressed, single-line stylesheet and expands it so that each rule has its own block and each declaration its own line. It is what you reach for when you have pulled a minified file out of a bundle and need to see what a rule actually says.
The formatting runs in your browser. Be aware that comments are not carried through, so use this on minified files rather than as the formatter for a stylesheet you maintain.
- Paste the minified or badly formatted CSS into the input box.
- Read the expanded output, where each rule opens a braced block and each declaration sits on its own indented line.
- Copy the result into an editor to read or search through it.
- Copy out any comments from the original first, because the formatter removes them.
- For code you own, set up Prettier or stylelint in your editor instead, so formatting happens on save and comments survive.