CSS Beautifier

Formats minified or inconsistent CSS with one declaration per line and two-space indentation. Splits selector lists, spaces combinators and never touches strings, url() values or comments.

The output will appear here.
Advertisement icyabmod — admin panel included: update your website yourself, no code

How CSS Beautifier works

Formats minified or inconsistent CSS with one declaration per line and two-space indentation. Splits selector lists, spaces combinators and never touches strings, url() values or comments.

Input CSS
Output Readable CSS
Works done 1,410

How to use it

This CSS beautifier takes a minified or inconsistently written stylesheet and lays it out with one declaration per line and two spaces of indentation. Selector lists are split onto separate lines, combinators get consistent spacing and media queries are indented like any other block. Strings, url() values and comments are treated as untouchable, and the formatting runs in your browser.

How to beautify CSS

  1. Paste your CSS, from a single rule to a full theme stylesheet.
  2. Run the formatter with the "Run tool" button or the Ctrl + Enter shortcut.
  3. If a brace error appears, jump to the line it names and fix the imbalance.
  4. Copy the formatted stylesheet or download it as a text file.

What the formatter changes

  • One declaration per line, indented two spaces and written as color: #fff; with a single space after the colon.
  • A trailing semicolon is added to the last declaration of each block, so adding a line later cannot silently break the rule.
  • Selector lists split: .btn:hover,.btn:focus becomes two lines ending in .btn:focus {.
  • Combinators spaced: ul>li+li becomes ul > li + li.
  • At-rules tidied: @media (max-width:600px) becomes @media (max-width: 600px), and nested rules are indented one level deeper.
  • Blank lines between top-level blocks, which makes long files easier to scroll.

What it deliberately leaves alone

A formatter that edits values is a liability. These inputs pass through exactly as written:

InputWhy it is protected
content: ";}"Punctuation inside strings is not structure
url(data:image/png;base64,...)The semicolon inside a data URI must not start a new declaration
font: 12px/1.5 sans-serifThe slash is part of the shorthand
.sm\:p-4, .w-1\/2Escaped characters in utility-class names stay escaped
[class~="active"]The tilde here is an attribute operator, not a sibling combinator
Comments, !important, declaration orderChanging any of them could change the cascade

Reading the two error messages

Because the stylesheet is parsed rather than pattern-matched, unbalanced braces stop the formatter with a precise message. Unexpected "}" on line 14. means a closing brace has nothing to close. Missing "}" for the block opened on line 3. means a block that starts on line 3 never ends; the real culprit is often a media query or nested block inside it that lost its closing brace. Browsers tend to recover from these mistakes by silently ignoring the rules that follow, which is why a single missing brace can explain why half a stylesheet does not apply.

Typical jobs for a CSS beautifier

  • Reading a theme's or plugin's minified stylesheet to see which selector you need to override.
  • Making rules copied from the browser's developer tools readable before you commit them.
  • Normalizing a file edited by several people before a code review, so the diff shows real changes.
  • Untangling the large <style> block of an HTML email template.
  • Cleaning plain CSS before restructuring it with the CSS to SCSS converter.

Not included, and privacy

The beautifier does not sort properties, add vendor prefixes, shorten colors, merge duplicate rules or validate property names, and indentation is fixed at two spaces. SCSS-only syntax such as // comments is not valid CSS and may format oddly; compile it first with the SCSS to CSS converter. Your code is processed by JavaScript in your browser and is not sent to the server; the page only increments an anonymous usage counter. For the markup side of a page, use the HTML beautifier.

Advertisement Kelivo — a word game by icyabmod, on Google Play and the App Store

Frequently asked questions

No. Only whitespace, line breaks and indentation are added; selectors, values, declaration order and important flags stay as they were. The one character the tool may add is a semicolon after the last declaration in a block, which does not change meaning in CSS. Because rule order is preserved, the cascade is identical and you can replace the original file with the formatted one.

Not directly, since this page only produces readable output. For a small snippet, a practical workaround is to wrap the CSS in a style element and run it through the HTML minifier, which also compacts embedded stylesheets. For real projects, minification belongs in your build step, where it runs automatically on every release instead of being repeated by hand.

It means a block that starts on that line never gets its closing brace before the end of the file. The mistake is usually inside the block, for example a media query or nested rule that was not closed, rather than at the end of the outer rule. Count opening and closing braces from the reported line downwards. The opposite message, Unexpected "}", points to an extra closing brace.

No. Declarations stay in their original order, because order can matter: a shorthand such as margin followed by margin-top behaves differently if the two are swapped. If your team wants a consistent property order, enforce it with a linter rule in your editor or build pipeline, where it can be reviewed. This tool changes layout only, never meaning.