This page takes compact or badly spaced CSS and writes it back with one declaration per line, indented rule blocks and a blank line between top-level rules. Paste a stylesheet, choose two spaces, four spaces or a tab, and the output appears beside the form. Comments can be kept or removed with a checkbox.
It is a formatter, not a validator. It does not check property names, resolve custom properties or tell you that a selector is invalid. Its job is to make the structure visible so a human can review it, and to turn a minified file back into something readable.
What changes in the output
Each rule is written as a selector line, an opening brace, one declaration per line and a closing brace. Declarations keep their property and value text; the formatter adds a colon and a space where needed and a semicolon at the end of each line. Nested blocks such as a media query are indented one level deeper than the rule that contains them.
The output is longer than the input because it adds line breaks and indentation. That is expected. The character count in the stats will rise even when the CSS is already valid and well spaced, so do not read the increase as a problem.
At-rules are kept in place. A @media block is written with its query on the same line as the at-keyword, and the rules inside it are indented. The formatter does not rewrite the query, add spaces around the colon in (max-width:600px), or normalise a font stack such as system-ui,sans-serif. Those are value-level changes, and it deliberately leaves values alone.
Indentation and comments
The indent control offers two spaces, four spaces or a tab. Two spaces is the common choice for CSS because it keeps deeply nested media queries readable without pushing rules far to the right. A tab is compact on screen but renders at different widths in different editors, so agree with the rest of the project before using it.
Comments are kept by default. Clearing the checkbox removes both standalone comments and inline comments such as /* inline */ at the end of a declaration. That is useful before pasting a stylesheet into a size-sensitive build, but it also removes licence headers and source-map hints. Keep a copy of the original if those matter.
The formatter does not add comments, reorder declarations, merge duplicate selectors or remove unused rules. Two rules with the same selector stay two rules, in the order they appeared. If you need dead-code removal or selector merging, that is a build-step job with a real parser, not a text formatter.
A worked example
A 232-character stylesheet with a custom-property block, a body rule, a card rule and a media query was pasted with two-space indentation. The page reported 21 lines, 5 rule blocks and 300 output characters.
| Input | Setting | Result |
|---|---|---|
| Four-rule stylesheet, 232 characters | 2 spaces, comments kept | 21 lines, 5 blocks, 300 characters |
a{color:red;margin:0} | Tab, comments kept | 4 lines, 30 characters |
| Rule with two comments, 56 characters | 2 spaces, comments removed | 4 lines, 37 characters |
The tab run is the smallest useful check: the selector, two declarations and the closing brace each end up on their own line, with a tab before each declaration. The comment-removal run dropped both the leading comment and the inline one, leaving the rule itself unchanged.
In the larger run the media query stayed at the end and its inner rule gained a second level of indentation. The output is valid CSS as long as the input was valid; the formatter does not repair an unclosed brace or a missing colon.
Strings, custom properties and edge cases
Values are copied as text, so a quoted font name or a data URI keeps its punctuation. Custom properties such as --ink: #1c1b18; are formatted like any other declaration. The formatter does not try to parse the value, which is why it will not break a calc() expression or a url() containing a semicolon.
An empty input produces an empty result rather than an error. A file with only comments and no rules is formatted as comments, and the rule-block count is zero. Very large stylesheets are processed as text in the tab; there is no server round trip, so the practical limit is the browser's patience rather than a quota.
When to beautify and when to minify
Beautify when you are reading, reviewing or debugging. Minify when you are shipping, because whitespace and comments are bytes the browser does not need. The two operations are opposites, and a round trip through both should return the same rules even though the text will not be byte-identical.
This page is the readable direction. The CSS minifier is the other one. If you are formatting HTML that contains a style block, use the HTML beautifier instead; it treats the style block as text and does not format the CSS inside it.