Skip to content
AllToolsDesk

Popular

  • JSON Formatter & ValidatorFormat, minify and validate JSON with error locations.
  • CSS FormatterBeautify CSS, SCSS and Less with Prettier.
  • CSS MinifierCompress CSS and see the bytes saved.
  • JavaScript FormatterBeautify JavaScript and TypeScript.
  • JavaScript MinifierMinify JavaScript with Terser.
  • HTML FormatterIndent HTML, including inline CSS and JS.
  • JPG to PDFTurn images into a PDF, one per page.
  • Merge PDFCombine several PDFs into one file.
38 free toolsSee all tools

CSS Formatter

Beautify messy or minified CSS, SCSS and Less with consistent indentation and spacing. Powered by Prettier and runs in your browser.

Runs in your browser. Nothing is uploaded.

Ready.

About the CSS Formatter

Stylesheets drift out of shape over time: rules pasted from different sources, minified snippets copied from a library, or a file edited by several people with different habits. Inconsistent spacing makes CSS harder to review and to search.

Formatting rewrites the layout only, putting each selector and declaration on its own line with the same indentation everywhere, so the cascade is easier to follow and diffs in version control show real changes instead of whitespace. It is also the quickest way to read the CSS behind a minified file when you are debugging a style you did not write. SCSS and Less are supported, including nesting, variables and mixins.

How to use the CSS Formatter

  1. 1

    Paste your stylesheet, open a .css, .scss or .less file, or load the sample. Pasting, opening a file or loading the sample runs it automatically.

  2. 2

    Pick the syntax that matches your code, plus indent size and line width.

  3. 3

    Press Format. Each rule and declaration is placed on its own line with consistent spacing.

  4. 4

    Copy the result or download it.

Examples

1Expand minified CSS
Before
.btn{color:#fff;background:#16150f}.btn:hover{opacity:.9}
After
.btn {
  color: #fff;
  background: #16150f;
}
.btn:hover {
  opacity: 0.9;
}

Good to know

  • Formatting changes whitespace and quotes only. It does not reorder rules, remove duplicates or fix invalid properties.
  • Code with syntax errors (such as a missing closing brace) cannot be formatted until the error is fixed.

Frequently asked questions

Which formatter does this use?

Prettier, the open-source formatter used in most code editors, so the output matches what your team gets from Prettier with the same settings.

Can I format SCSS and Less?

Yes. Choose SCSS or Less under Syntax so nesting, variables and mixins are formatted correctly.

Is my code uploaded to a server?

No. Processing happens entirely in your browser, in a background thread. Your input is never sent to our servers or stored anywhere.

More tools that pair well with this one.

Browse all tools