Skip to content
cliplimeClipLime

Format and beautify CSS

Paste CSS, even minified CSS from a website, and get it laid out one declaration per line. Nothing leaves this tab.

Your text is processed in this tab and never uploaded

Options

a, b becomes two lines.

Writes a > b instead of a>b.

0 characters, 0 lines Your text stays in this tab.

Also handles most SCSS and Less. Unclosed comments, strings and brackets are reported, but the CSS is not checked against property names or values.

At a glance

What it does
Formats CSS as you type, one declaration per line with consistent indentation, or minifies it.
Options
2 or 4 spaces or tabs, one selector per line, blank lines between rules, spaces around combinators.
Also reads
Most SCSS and Less: nesting, variables and // comments.
Values
Colors, numbers and units are copied as written. Nothing is reordered.
Problems found
Unclosed comments, strings and brackets, and extra closing brackets, with line and column.
Not checked
Property names and values. It does not know whether a property exists.
Privacy
Runs in your browser tab. Your CSS is never uploaded.

How to do it

  1. 1

    Paste your CSS

    Paste a stylesheet or a few rules into the left box, drop a .css file on it, or press Example. Minified CSS copied from a website works too.

  2. 2

    Choose what to do

    Pick Format, then the indent and the spacing options. Pick Minify to remove comments and white space instead.

  3. 3

    Read the result

    The result updates as you type. Notes under it list any unclosed comment, string or bracket, with its line and column.

  4. 4

    Copy or download

    Copy the result or download it as a file.

What formatting does

The formatter puts each declaration on its own line, indents it inside its rule, and puts the closing brace on its own line. Selectors separated by commas go on separate lines by default, and rules are separated by a blank line. At-rules such as @media indent the rules inside them.

It changes layout only. Colors like #FFF stay #FFF, 0.5 stays 0.5, and the order of rules and declarations is never changed, because order decides which rule wins. It does not add a missing semicolon or fix a typo. After formatting, the result is compared with your input, and a note appears if anything other than white space differs.

Format or minify?

Format a stylesheet to read it, review it, or find a rule in minified CSS you copied from a page. Minify when you ship the file and bytes matter. Keep the formatted file as your source and minify at build time. The CSS minifier page explains exactly what is removed.

SCSS and Less

The formatter handles the common parts of SCSS and Less: nested rules, the & parent selector, $variables, @include, and // line comments. It lays them out like CSS. It does not compile anything and it does not understand every feature, so check the result for files that use advanced features such as maps, functions or loops.

Minify mode is for plain CSS only. SCSS and Less need to be compiled to CSS first.

Problems it reports

Browsers repair many CSS mistakes silently, which hides them. The formatter looks for the ones that usually mean something was lost:

  • A comment that is never closed, which swallows everything after it.
  • A string that is not closed before the end of the line.
  • A {, ( or [ that is never closed, reported where it was opened.
  • An extra closing bracket with nothing open.

These appear as notes under the result with their line and column. The CSS is still formatted. Whether a property name or value is valid is not checked.

Questions people ask

Does it sort my properties or rules?

No. Declarations and rules stay in the order you wrote them. Reordering CSS can change which rule applies, so a formatter should not do it.

Can it format minified CSS from a website?

Yes. Paste the minified text and it is laid out again. Comments that were removed when it was minified cannot come back, and names such as class names stay as they are.

Does it check that properties and values are valid?

No. It checks only for unclosed comments, strings and brackets. A misspelled property such as colour is formatted like any other.

Will it keep my comments?

Yes. Comments are kept in place when formatting. Minify mode removes them, except license comments that start with /*! unless you turn that off.

Does it work with SCSS or Less?

It formats most of their syntax like CSS, including nesting and // comments. It is a layout tool, not a compiler.

Is my CSS uploaded?

No. The CSS formatter loads into your browser tab and runs there. Your styles are never sent anywhere.