CSS Formatter

Paste CSS and get it back readable, with one declaration per line, or as small as possible. The meaning of the CSS does not change.

Use the tool

Loading the tool…

About CSS Formatter

Paste CSS and choose a mode. "Make it readable" adds line breaks and indentation, and you can choose 2 spaces, 4 spaces or a tab, and whether to leave a blank line between top-level rules. "Make it small" removes the spaces and line breaks to reduce the file size. You can download the result as a CSS file.

Worked example

Paste `a{color:red;margin:0 auto}`. In readable mode, you get each property on its own indented line.

Limits

The formatter does not check whether your CSS is correct or whether it looks right on the page. Test the result in a browser.

How to use CSS Formatter

  1. Paste your CSS.
  2. Choose beautify or minify.
  3. Choose the indent and blank lines.
  4. Copy or download the result.

Good to know

  • Strings, url() values and custom properties are left as written.
  • Minify removes comments, except comments that start with /*!.
  • Selector lists are put one per line when beautifying.
  • The tool does not check whether property names are valid.

Frequently asked questions

Does minifying change my CSS?

Only white space and comments are removed, and the last semicolon in each block.

Does it support CSS nesting?

Yes. Nested rules are indented inside their parent.

Can it sort my properties?

No. Properties stay in the order you wrote them, because order can matter.