Skip to content
Devtoolry

CSS Formatter

Format and beautify CSS, SCSS and Less online with Prettier. Turn minified or messy stylesheets into readable, consistently indented code in your browser.

Runs in your browser · Nothing uploadedFree · No sign-up

Something not working, or missing a feature? Send feedback

About the CSS Formatter

The CSS Formatter makes compressed or inconsistent stylesheets readable again, one declaration per line with consistent indentation. It understands CSS, SCSS and Less.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the CSS Formatter

  1. Paste your stylesheet or open a file.
  2. Choose the syntax (CSS, SCSS or Less) and indentation.
  3. Copy or download the formatted code.

Example

Expand a minified stylesheet

Input

.btn{display:inline-flex;padding:8px 16px;border-radius:6px}.btn:hover,.btn:focus-visible{background:#2563eb;color:#fff}@media (max-width:600px){.btn{width:100%}}

Result

.btn {
  display: inline-flex;
  padding: 8px 16px;
  border-radius: 6px;
}
.btn:hover,
.btn:focus-visible {
  background: #2563eb;
  color: #fff;
}
@media (max-width: 600px) {
  .btn {
    width: 100%;
  }
}

Each rule and declaration gets its own line, selectors in a list are split one per line, and the @media block is indented. No rule is removed or reordered.

Common mistakes

  • Choosing CSS for SCSS code. Nested rules, $variables and @mixin are not plain CSS. If the formatter reports an error on a nested selector, switch the syntax to SCSS or Less.
  • A missing closing brace. One unclosed { makes everything after it part of the same rule. The error points to the end of the file; look for the last rule that opened without closing.
  • Expecting smaller output. Formatting makes CSS longer and easier to read. For production files use the CSS Minifier, which removes the whitespace again.

Works well with the CSS Formatter

Frequently asked questions

Can I format SCSS with nesting and variables?

Yes. Choose SCSS (or Less) and nested rules, variables and mixins are formatted correctly.

Does it remove unused rules?

No. Formatting never removes or reorders rules; it only changes whitespace and layout.

Does it change colours or units?

Values are kept as written, except that letter case and spacing are normalised. #FFF is printed as #fff, but it is never converted to another format.

Is my stylesheet uploaded?

No. Prettier runs in your browser, so the CSS never leaves your device.

Guides and tutorials