{}
Runs in your browserNothing is uploadedDeveloper

CSS Formatter

Beautify CSS with one rule and one declaration per line, or minify it to save bytes by removing comments and whitespace.

Loading tool…
Short answer

CSS Formatter beautifies a stylesheet with one selector and one declaration per line, or minifies it by removing comments and unneeded whitespace. Strings, calc() expressions and media queries are kept intact either way.

What does a CSS formatter do?

Beautify and minify

Beautifying adds line breaks and indents so each rule is easy to scan. Minifying does the opposite to save bytes: it drops comments, spaces around braces and colons, and the last semicolon in each rule. The styles mean exactly the same thing.

Why use CSS Formatter?

  • Safe minification. Spaces that matter, such as those around + and - inside calc(), and anything inside quotes, are kept.
  • Keep licences. Comments starting with /*! are kept when minifying, which is the usual convention for licence notices.
  • Read any stylesheet. Turn a minified file from a website into readable CSS to learn from or debug.

How to use CSS Formatter, step by step

CSS Formatter in PrintxPDF with a file loaded, options on the right and the run button below
CSS Formatter with a file loaded: the steps below follow this screen.
  1. Paste your CSS into CSS Formatter. A rule, a stylesheet or minified CSS.
  2. Choose Beautify or Minify. Pick the indent, or whether to keep licence comments.
  3. Copy or download the result. It updates as you type.

Frequently asked questions

How much smaller does minified CSS get?

Usually 15 to 30 percent before compression, depending on how many comments and how much indentation the source has.

Does it merge or reorder rules?

No. It changes whitespace and comments only, so the cascade order stays exactly as you wrote it.

Does it handle SCSS or nested CSS?

Nested rules are indented correctly. SCSS features such as variables and mixins are left as written, but it is built for plain CSS.

Looking for the long version? The guides cover each of these jobs in depth.