Skip to tools

Formatters

CSS Formatter

Minified or hastily written CSS packs selectors and declarations together until they are hard to review. The CSS Formatter puts each rule on its own block, each declaration on its own line, and indents media queries so their contents are clearly grouped.

It is handy when you need to read a production stylesheet, compare a theme override, or tidy up CSS before committing it.

How to use the CSS Formatter

  1. 1Use the CSS Formatter right on this page, or open the full workspace for history, sharing and every other tool.
  2. 2Paste your input, upload a file, or drag and drop a file onto the input box (up to 25 MB).
  3. 3The result appears in the output panel automatically and updates when you change the input or an option.
  4. 4Use Copy Output or Download to save the result. Nothing is uploaded to a server.

Example

Two compressed rules become readable blocks with one declaration per line.

Input
body{margin:0;padding:0;color:red}a{color:blue}
Output
body {
  margin: 0;
  padding: 0;
  color: red
}

a {
  color: blue
}

When to use it

  • Reading a minified stylesheet from a third-party widget or theme
  • Cleaning up CSS pasted from browser dev tools
  • Making a code review easier by normalising spacing first

Tips and common mistakes

  • Format both versions before comparing them in the Diff Checker for a clean diff.
  • Comments are kept, so explanatory notes survive the formatting.
  • A missing closing brace makes everything after it nest incorrectly — check the indentation.

Frequently asked questions

Does it support media queries?

Yes. Rules inside @media blocks are indented one extra level.

Will it reorder my properties?

No. Declarations stay in the order you wrote them.

TutorialHTML, CSS and JavaScript beautification: a quick tour

Related tools

Ready to try it?

Free, no sign-up, and your data never leaves your browser.