CSS Beautifier
Format and unminify CSS, SCSS and Less with Prettier. Choose indentation and line width, then download the result. All in your browser, nothing uploaded.
What this tool does
It takes minified, badly indented or simply inherited CSS and hands it back readable: one declaration per line, consistent indentation and separated blocks. It supports CSS, SCSS and Less, and all the work happens in your browser.
It is the exact inverse of the CSS minifier: one prepares the file for production, this one prepares it for a human to understand.
What comes back and what does not
Worth being clear about, because there is a common expectation that cannot be met.
Restored: indentation, line breaks, spacing around colons and braces, one selector per line when there are several, and readable rule order.
Not restored: comments, which the minifier deleted and are nowhere in the file. Nor the original names if the process included class obfuscation — as some bespoke CSS tooling does — because .a1b2 is all that is left in the file.
Put another way: you recover the structure, not the original. And the structure is enough to read, debug and modify the sheet.
When you actually need this
- Auditing a production site’s CSS, yours or someone else’s, when all you have is the final bundle.
- Recovering a stylesheet whose source was lost and only the deployed version survives.
- Unifying the style of a file five people have touched with five different editor configs.
- Reviewing an impossible diff where someone committed minified CSS and the change shows up as a single twenty-thousand-character line.
SCSS and Less are not CSS
Picking the right dialect above is not cosmetic. The plain CSS parser does not understand nesting, mixins, @extend or variables with $ and @, so it would reject a perfectly valid SCSS file as a syntax error.
If your file has preprocessor nesting or variables, select SCSS or Less and it will work.
The most frequent syntax errors
Formatting requires parsing first, so a file that cannot be parsed cannot be formatted. The three cases that come up again and again:
- An unclosed brace. The error usually points far below the real spot, because the parser keeps swallowing rules until something becomes impossible. Start searching from the reported line upwards.
- An extra semicolon right before the closing brace in some nested constructs.
- A half-finished copy and paste that leaves the file cut in two. It sounds silly, and it is the most common cause.
The tool gives you line and column, which is what saves the time.
About the formatter
It uses Prettier (MIT licence) compiled for the browser. It is opinionated on purpose: it offers almost no options because its value lies in two people getting the same result. What you can adjust here is the indentation — two spaces, four, or tabs — and the maximum line width.
Frequently asked questions
Can I recover the original CSS from a minified file?
You recover the structure, not the exact original. Minifying drops comments and intermediate variable names, and that cannot be reconstructed. What does come back is the indentation, line breaks and rule order, which is what you need to read and understand the stylesheet.
Does it format SCSS and Less as well as CSS?
Yes. Pick the dialect above and the matching parser is used. It matters because SCSS and Less have nesting, mixins and variables that the plain CSS parser does not understand and would reject as a syntax error.
Why is it telling me there is a syntax error?
Because formatting requires parsing the code first, and if it cannot be parsed there is nothing to format. The most common causes are an unclosed brace or an extra semicolon inside a declaration. The tool gives you the line and column so you can go straight there.
Is my CSS uploaded to a server?
No. Prettier runs compiled to JavaScript inside your browser and the formatting happens on your machine. You can confirm it in the network tab of your developer tools: formatting fires no request.
Reviews & ratings
No reviews yet. Be the first to leave one!
Related guides
Blog tutorials where this tool comes in handy.
Related tools
Others from the catalogue that pair well with this one.