Boneyard Tools

CSS Formatter and Beautifier

Paste minified or messy CSS to pretty-print it instantly. Each selector goes on its own line, declarations are indented one per line, and spacing around colons is normalized.

How to format CSS

  1. Paste your CSS into the input box.
  2. Pick an indent size: 2 spaces, 4 spaces, or a tab.
  3. Copy the formatted CSS or download it as a .css file.

Examples

Beautify a minified rule

a{color:red;font-weight:bold}
a {
  color: red;
  font-weight: bold;
}

Nested media query

@media (max-width:600px){body{margin:0}}
@media (max-width:600px) {
  body {
    margin: 0;
  }
}

Frequently asked questions

Is my CSS sent to a server?

No. Formatting runs entirely in your browser with JavaScript, so your CSS never leaves your device.

How does the formatter decide where to break lines?

Each selector or at-rule prelude gets its own line with the opening brace, every declaration sits on its own indented line ending in a semicolon, and the closing brace drops to its own line. A blank line separates top-level rules.

Does it handle nested at-rules like @media?

Yes. Rules inside @media, @supports and similar blocks are indented one extra level so the nesting stays readable.

Will it change my property values or colors?

No. It only normalizes whitespace and layout. Values, colors, quoted strings and comments are kept exactly as written.

Can I run it on already-formatted CSS?

Yes. The formatter is idempotent, so reformatting tidy CSS returns the same result without piling on extra blank lines.

What indentation can I choose?

Two spaces, four spaces, or a tab. Pick whatever matches your project's code style.

Related tools