CSS Prettifier
Re-indent and clean up minified or messy CSS — every selector on its own line, every declaration on its own line.
Quick answer: Re-indent and clean up minified or messy CSS — every selector on its own line, every declaration on its own line.
Last updated
Frequently asked questions
- Will it preserve comments?
- Yes — both <code>/* block */</code> and inline-style <code>//</code> are kept (though only block comments are valid CSS; inline ones are passed through if you have them as a quirk of preprocessor input).
- How does it handle <code>@media</code> and other at-rules?
- At-rules are nested correctly — inner declarations are indented one level deeper than the at-rule's body. Multiple at-rules at the same level keep one blank line between them.
- Will it format SCSS or Less?
- Mostly — the tokeniser doesn't understand the full preprocessor grammar (interpolation, mixins, <code>@if</code>) but plain SCSS often round-trips fine. For accurate preprocessor formatting, use Prettier with the SCSS plugin.
- Does it merge or split selectors?
- Comma-separated selectors are split onto one selector per line so diffs stay clean. The semantics are unchanged.
- Can I change the indent size?
- Yes — drag the slider from 0 to 8 spaces. The default is 2.
- Will it preserve unusual property names?
- Yes — vendor prefixes (<code>-webkit-</code>, <code>-moz-</code>), CSS custom properties (<code>--my-var</code>) and unknown properties all pass through unchanged.
- Does it validate the CSS?
- No — formatting is structural only. Pass the result through the W3C CSS Validator if you need spec compliance.
- Are my files uploaded?
- No — every transformation runs in your browser. Even confidential design tokens are safe to paste here.
- How big a file can I prettify?
- Files up to a few megabytes prettify in well under a second. Above that, performance depends mostly on browser memory.
- Why does the output sometimes lose semicolons?
- We always emit a trailing semicolon at the end of each declaration — if you don't see one, the input was missing the value too. Compare side by side to spot the actual missing piece.