Skip to content
๐Ÿ–Œ

CSS Beautifier

Reformat minified or messy CSS into an indented, readable stylesheet. Runs entirely in your browser.

Runs in your browser

Updated

Selector lists are split one per line, nested at-rules and keyframes are indented, and each declaration ends with a semicolon. Values are left exactly as written, so a beautified file behaves identically to the one you pasted in.

What the formatter changes

Paste minified or hand-edited CSS and the beautifier re-emits it with one selector per line, one declaration per line, and a chosen indent of four spaces, two spaces or a tab. Nested at-rules and keyframes are indented a level deeper, and each declaration closes with a semicolon. Values are never rewritten, so a beautified file behaves exactly like the one you pasted in.

A worked example

Feeding in .btn{color:red;margin:0} produces a rule block with the selector on the first line, colour on its own indented line, the margin below it and the closing brace aligned with the selector. A selector list with a comma is split so each selector sits on its own line sharing one block. A media query wraps its inner rules at a second indent level.

When part of the file cannot be parsed

Malformed sections are reported rather than silently dropped: up to five messages appear in an amber panel and the untouched source is carried through to the output, so nothing is lost. The stats line reports the output line count and character count, which is a quick way to see that the file grew from a single minified line into dozens of readable ones.

Where it stops

  • It is a beautifier, not a validator: unknown properties and invalid values pass through unchecked.
  • Only the first five parse messages are shown, so a badly broken file needs several passes.
  • No vendor prefixing, minification or autoprefixing.
  • Everything runs in the tab; nothing is uploaded, but very large stylesheets depend on browser memory.

Questions people ask

Will formatting change how the page looks?

No. Whitespace between declarations and after braces has no effect in CSS. Whitespace inside values is preserved, which is where it does matter.

Can I make the file smaller again?

This tool only expands. The CSS minifier does the reverse, and for markup the HTML beautifier follows the same pattern.