CSS Formatter & Beautifier
Paste CSS and reprint it with nested rules, queries, and declarations on their own indented lines.
About this tool
Beautify and pretty-print mean indentation. A rule, a nested rule, a media query, a supports query, and a layer block each get a brace level. Custom properties and values such as rgb() stay on the declaration. Strings and comments are copied, so a brace or semicolon inside them does not start a new line.
Use it to read a minified stylesheet, to line up a component’s nested CSS, or to see a query before you edit it. The tool does not know which properties your browser supports. An unbalanced brace or an open string is an error. Tabs use one tab per level. The size applies when the style is spaces.
The result is still CSS, and the source stays in this browser.
How to use it
- Paste a stylesheet, or choose a local file. The file is read on this page and is not uploaded.
- Choose an indent, then Format CSS. Ctrl+Enter or Cmd+Enter does the same thing from the box.
- Copy or download the reprint. An open string, comment, or brace is reported instead of being guessed.
Limitations
- This pretty-prints structure. It does not validate property names, add prefixes, or sort declarations.
- Only /* */ comments are recognized. A declaration stays intact inside parentheses and inside quotes, and a source longer than 1 MB is refused.
Brace depth decides the line breaks
Blocks break onto new lines when parentheses allow it
Braces and semicolons are the line breaks. The formatter is a scanner. It copies comments and quoted strings as whole spans, and it copies characters that sit inside parentheses without treating them as blocks. A media query can therefore keep its parenthesized condition on the opening line, and a color function can keep its commas inside the parentheses, while the rule block that follows still breaks after the opening brace. Each declaration that ends with a semicolon at parenthesis depth zero starts a new line. The matching close brace drops the indent and starts a new line of its own.
Indent is two spaces, four spaces, or one tab per open brace. A byte-order mark at the start is removed. Runs of spaces, tabs, and line breaks between tokens collapse to a single space when a space is still needed to separate tokens. Space before a brace is normalized so the brace sits at the end of the selector line. The finished text is trimmed.
The scanner copies names it does not understand
Property names are not checked against any browser list. A made-up property is indented the same way as color. Values are not rewritten: a hex color is not converted, a unit is not calculated, and a custom property is not resolved. A comment that never closes is an error. A string that hits a line break before its closing quote is an error, because this scanner does not allow a raw break inside quotes. An extra close parenthesis, a close brace while parentheses are still open, and a file that ends with an unclosed brace or parenthesis are errors. Nothing is auto-corrected.
Minify is a separate, blunter pass
This page does not delete comments, and it does not pull a whole stylesheet onto one line. The minifier does that with a character substitution that is not this scanner. Vendor prefixes, nested rules, and at-rules are indented when their braces line up. They are not validated. Use the formatter when you want to read a stylesheet. Use the minifier when you want fewer characters and you accept that the substitution does not understand strings the way this scanner does.
Privacy
Your CSS is processed in your browser and is not uploaded to UtilChain. File names, source text, and results are not sent to analytics.

