The Util Box

CSS Beautifier

Free online css beautifier for developers. Format and beautify CSS code. Fast and private.

Formatted
Paste CSS above

Embed this tool

Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.

<iframe src="https://www.theutilbox.org/embed/css-formatter" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free CSS Beautifier tool from The Util Box"></iframe>
<!-- Free tool by The Util Box — https://www.theutilbox.org/tools/css-formatter -->
<a href="https://www.theutilbox.org/tools/css-formatter">CSS Beautifier by The Util Box</a>

Frequently Asked Questions about CSS Beautifier

CSS Formatter — Clean Up a Stylesheet

This CSS formatter rewrites a stylesheet with consistent formatting: one rule per line, two spaces of indentation inside a block, a single space after each colon, and every declaration on its own line.

It is the quick way to make a minified stylesheet readable, or to tidy a file that has been assembled from several sources with conflicting spacing.

What It Does to Your CSS

  • Rules are split so the selector sits on its own line and the opening brace stays with it.
  • Declarations are split one per line, indented two spaces inside the block.
  • Colons are normalised to a single space after them, and commas get a following space.
  • Blank runs are collapsed, and trailing whitespace is trimmed.

Honest Limits

  • It works by regular expression, not by parsing. A brace, semicolon or colon inside a string value — content: "{" or a background: url(a;b.png) — will be treated as CSS punctuation and the output will be broken.
  • Comments are left where they are, which means a comment containing a brace or a semicolon will also confuse it.
  • No property validation, so an invalid declaration survives the formatting untouched.
  • Custom properties and at-rules are treated as ordinary text. A --my-var value containing a semicolon will be split as if it were a declaration.

Related Developer Tools

The formatting runs entirely in your browser — your CSS is never uploaded.