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
- Paste your CSS, from a single rule to a full theme stylesheet.
- Run the formatter with the "Run tool" button or the Ctrl + Enter shortcut.
- If a brace error appears, jump to the line it names and fix the imbalance.
- 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:focusbecomes two lines ending in.btn:focus {. - Combinators spaced:
ul>li+libecomesul > 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:
| Input | Why 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-serif | The slash is part of the shorthand |
.sm\:p-4, .w-1\/2 | Escaped characters in utility-class names stay escaped |
[class~="active"] | The tilde here is an attribute operator, not a sibling combinator |
Comments, !important, declaration order | Changing 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.