Swelıty
Tools for everyone

Free Online CSS Formatter / Minifier

Format and minify CSS code. Improves readability or compresses CSS structural data.

Input

Output (Formatted)

How to use

  1. Paste your CSS into the input box, or open a .css file.

  2. Choose Format or Minify.

  3. Read the output. A message appears if the tool cannot parse the input.

  4. Copy the result or download it as formatted.css or minified.css.

Why use this tool

  • Prettier formatting

    Consistent indentation, spacing and line breaks, with your rules and declarations in their original order.

  • CSSO minifying

    Removes white space and ordinary comments, and restructures rules to save more bytes.

  • Licence comments

    Comments that start with /*! are kept when you minify.

About this tool

The CSS Formatter makes style sheets readable or smaller. Format uses Prettier to put each declaration on its own line with consistent indentation and spacing, which helps when you open a one-line production file or tidy styles from several people. Minify uses CSSO to remove spaces and comments and merge rules that repeat the same declarations. The output updates as you type.

Use it to read a minified file, to clean up CSS before a code review, or to make a style sheet smaller before it goes live. Formatting changes only layout, and minifying keeps the page looking the same. Licence comments can be kept.

To try your CSS on a page as you write it, open the CSS Playground, and to format other code use the JSON Formatter.

Frequently asked questions

No. A syntax error may be reported, but a misspelt property or a value the browser ignores will pass through.

No. Format keeps your order.

CSSO is designed to keep the same result, but because it moves and merges rules, test the minified file on your pages, especially if you rely on the order of overrides.

The tool is set up for plain CSS. Compile Sass or Less first, for example in the Sass Playground.

Paste it and choose Format. Line breaks and indentation come back, but comments that were removed cannot be restored.

Paste the CSS and choose Format. Each rule and declaration goes on its own line with consistent indentation.

Paste your CSS and choose Minify. Spaces and comments are removed and repeated rules can be merged, so the file is smaller.