Skip to content

Free CSS Formatter

Turn minified or untidy CSS into clean, indented rules with one declaration per line.

  • 100% free
  • Runs in your browser
  • Instant results
Quick answer

A CSS formatter, or beautifier, rewrites a stylesheet so that every selector and declaration sits on its own line with consistent indentation. Paste minified or messy CSS, choose an indent, and copy readable code. Nested blocks such as media queries are indented one level deeper. Values are never changed.

How to use the CSS Formatter

  1. Paste your CSSPaste a stylesheet, a minified file or a handful of rules.
  2. Choose the indentPick 2 spaces, 4 spaces or tabs.
  3. Copy or downloadCopy the formatted CSS or download it as a .css file. A warning appears if the braces do not balance.

The style this CSS formatter produces

The CSS formatter applies the layout most style guides agree on:

  • Each selector in a comma-separated list goes on its own line, and the opening brace follows the last one after a space.
  • Each declaration goes on its own line, indented, written as property: value; with one space after the colon.
  • Every declaration ends with a semicolon, including the last one in a rule. That avoids the classic bug of adding a line later and forgetting the semicolon above it.
  • The closing brace sits on its own line, and a blank line separates top-level rules.
  • Blocks inside blocks, such as @media, @supports, @keyframes and native CSS nesting, are indented one level deeper.
  • Comments are kept in place.

Only whitespace changes. Strings, url() values, calc() expressions and custom properties are copied exactly, so a semicolon inside a data URI or a quoted string does not split a line. Selectors are not rewritten, so a>b stays as you typed it.

When a CSS beautifier is useful

The usual reason is reading someone else's stylesheet. Production CSS is normally minified to one line, which is impossible to scan. Formatting it lets you find the rule that sets a colour, see which media query a rule lives in, or compare two versions in a diff tool such as the text diff checker.

It is also handy for cleaning up styles that have been edited by several people with different habits, or copied out of browser developer tools.

The formatter does not validate your CSS. It will happily format an unknown property or a misspelled value. It does count braces and warns when the numbers of { and } differ, which usually means a rule was cut off when copying.

Everything runs in your browser and nothing is uploaded. When you are done editing, the CSS minifier compresses the file again for production.

Frequently asked questions

How do I format CSS online?

Paste your stylesheet into the CSS formatter and choose an indent. Each declaration is put on its own line and the result can be copied or downloaded.

Can it unminify CSS?

Yes. Minified CSS on a single line is expanded into indented rules. Comments removed by the minifier cannot be restored.

Does formatting change how my CSS works?

No. Only spaces and line breaks between tokens change, plus a semicolon is added after the last declaration of a rule if it was missing. Values and selectors stay the same.

Does it support media queries and nested CSS?

Yes. Any block inside another block is indented one level deeper, which covers @media, @supports, @keyframes, @layer and native nesting. SCSS-style nesting formats well too, though // comments are not understood.

Is my CSS uploaded?

No. Formatting happens in your browser.

Last updated 24 November 2026 by the TheTechFolk team.