CSS Formatter

Beautify CSS with 2 or 4 space or tab indent and an optional blank line between rules. Handles media queries. Free, in your browser.

Input
Result

About CSS Formatter

The CSS Formatter turns minified or messy CSS into a clean stylesheet with every rule and declaration on its own line. Media queries are handled too.

Indent your way

2 spaces, 4 spaces or tabs, with an optional blank line between rules for extra breathing room.

Nothing else changes

Selectors, properties, values and comments stay as typed; only the spacing is changed. Properties are not reordered.

Not a validator

Unknown properties and missing braces are not reported, so check the result in your browser.

Good for

Reading a minified stylesheet from a live site, cleaning CSS pasted from a design tool, and learning CSS.

Private

Everything runs in your browser. Nothing you paste is uploaded.

When to format CSS

Format minified CSS when you need to read or debug it, such as a theme or a third-party file. Minify it again before you publish.

How to use CSS Formatter

  1. Paste your CSS or open a file.
  2. Choose the indent and the blank-line option.
  3. Read the formatted CSS.
  4. Copy it or download a .css file.

Related guide: Speed Up Your Website: Minify CSS, JavaScript and HTML

Help & FAQ

What does the CSS Formatter do?

It puts each CSS rule and declaration on its own line with the indent you choose.

What indent options are there?

Two spaces, four spaces or a tab.

What does Blank line between rules do?

It adds an empty line between top-level rules. It is on by default and can be turned off for a tighter layout.

Does it format media queries?

Yes. In the test the @media block was kept and the rule inside it was indented one level deeper.

Are comments kept?

Yes. The comment /* c */ stayed in the output.

Does it change our values or colours?

No. Only spacing changes, for example a space after each colon.

Does it sort properties?

No. Properties stay in the order you wrote them.

Does it check for errors?

No. It is a formatter, not a validator. Check the result in a browser or a CSS linter.

Can we turn minified CSS back into readable CSS?

Yes. Paste it in and the original layout is rebuilt, though the original comments and spacing choices are not restored if they were removed.

Is there an example?

Yes. Press Load example to fill the box with sample CSS.

Can we continue working on the result?

Yes. Press Use result as input to move the output back into the input box.

Is our CSS uploaded?

No. It is formatted in your browser.

More in Developer Tools

See all 39 in Developer Tools