CalcCafe

CSS Beautifier

Paste minified or messy CSS and instantly get clean, consistently indented, Prettier-formatted output.

Example

Minified input:

.box{margin:0;padding:10px 20px;color:#FFF}

Beautified output:

.box {
 margin: 0;
 padding: 10px 20px;
 color: #fff;
}

How it works

Paste CSS into the input pane and click Beautify (or it formats as you type). It uses Prettier's CSS parser to reindent, normalize spacing, and tidy every rule and declaration.

Good to know

CSS Beautifier takes a block of compressed, single-line, or inconsistently spaced CSS and rewrites it into clean, predictably indented code using the Prettier formatting engine. It is aimed at front-end developers, students, and anyone who has copied a minified stylesheet out of a build bundle, a CMS theme, or a third-party widget and needs to actually read or edit it. Because it runs Prettier directly in your browser tab, the CSS you paste is never sent anywhere and the tool keeps working even if you go offline after the page loads.

Reach for it when you are reverse-engineering a production stylesheet, diffing two versions of CSS where one side is minified, preparing a clean snippet for documentation or a bug report, or standardizing files written by different people into one consistent style. The two-pane layout makes it easy to verify changes side by side: paste on the left, read the formatted result on the right, then copy it out. Output also refreshes automatically as you type, so you can paste and immediately see the tidy version without clicking anything.

To read the result, look for two-space indentation per nesting level, one declaration per line, a single space after each colon, and normalized casing such as hex colors lowercased to #fff. Nested at-rules like @media blocks are indented under their parent so you can see scope at a glance. If you paste invalid CSS, the status line reports a parse error with the first line of the message instead of producing output, which is a quick way to spot an unclosed brace or a stray character.

One caveat worth noting: this formatter uses Prettier's plain-CSS parser, so it is built for standard CSS, not preprocessor syntax. If your file contains SCSS variables, mixins, or LESS-specific constructs, the parser may reject it or strip meaning, so use a dedicated SCSS or LESS formatter for those. For pure CSS, treat beautifying as a cosmetic, lossless step: it changes whitespace and formatting only, never the rules your browser will apply.

Frequently asked questions

Does my CSS get uploaded to a server?
No. Formatting runs entirely in your browser using Prettier loaded on the page, so your CSS never leaves your machine.
Can it format SCSS or LESS too?
This tool uses Prettier's plain CSS parser. It handles standard CSS, media queries, and nested at-rules, but SCSS/LESS-specific syntax like variables or mixins should use a dedicated SCSS/LESS formatter.
Is my data uploaded anywhere?
No — this tool runs entirely in your browser. Your input never leaves your device and it works offline once loaded.
Is it free?
Yes, completely free with no sign-up and no limits.

People also ask

What is the difference between beautifying and minifying CSS?
Beautifying expands CSS with indentation and line breaks to make it human-readable, while minifying strips whitespace and comments to make the file as small as possible for faster loading. They are opposite operations and both preserve the same styling behavior.
Does beautifying CSS change how my website looks?
No. Reformatting only alters whitespace, indentation, and code style such as hex-color casing. The selectors, properties, and values that the browser applies remain identical, so rendering is unchanged.
Can I beautify CSS that contains errors or is broken?
Only if the CSS is syntactically parseable. The tool relies on Prettier's parser, so an unclosed brace or invalid token will trigger a parse error and no formatted output until you fix the issue.
What indentation does this CSS beautifier use?
It formats with two spaces per indentation level, which is Prettier's default for CSS. Nested rules such as media queries are indented under their parent block.
Is it safe to paste proprietary or client CSS into an online beautifier?
With this tool it is, because formatting happens entirely in your browser and the CSS is never uploaded to a server. Always confirm a given tool is client-side before pasting sensitive code, since not all online formatters work this way.
Why does my hex color get changed to lowercase after formatting?
Prettier normalizes hex color values to lowercase as part of its consistent style rules, so #FFF becomes #fff. The color value is exactly the same; only the letter casing is standardized.
Can a CSS beautifier handle media queries and nested at-rules?
Yes. Standard at-rules like @media, @supports, and @font-face are parsed and re-indented so their contents are nested under the rule. Preprocessor-only nesting from SCSS or LESS is not supported by the plain-CSS parser.

Related tools