Skip to content

CSS Formatter

Format and beautify CSS.

Loading…

About CSS Formatter

A minified stylesheet is one long line, hard to read and harder to compare. Paste it and press Format CSS: each selector starts a new line, declarations are indented by two spaces, a blank line separates rules, and combinators are spaced out so .a>.b becomes .a > .b. Comments and url() values are kept, and at-rules such as @media nest their rules one level deeper. The beautifier only works on layout and does not check that the rules are correct.

Features

  • One declaration per line, indented by two spaces
  • A blank line between rules
  • Spaces around combinators such as > and +
  • Comments and url() values kept as written
  • At-rules like @media indent their inner rules

Limitations

  • Nothing is formatted until you select Format CSS, and the indent is fixed at two spaces.
  • Errors such as a missing brace or colon are not reported, and the Valid marker only means formatting finished.
  • Layout is all that changes: missing semicolons are not added, properties are not sorted and shorthand is not expanded.

How it works

  1. Paste the stylesheet into the CSS Input panel.
  2. Select Format CSS.
  3. Read the Formatted CSS panel.
  4. Copy it with Copy Output, or select Clear All to start again.

Example input

.button{color:red;padding:10px;border-radius:4px}

Frequently asked questions