CSS Formatter & Beautifier

Format and beautify CSS stylesheets with sensible defaults. Everything runs in your browser, so your styles never leave the page.

About this CSS formatter

This is a free online CSS formatter and beautifier. Paste a minified or messy stylesheet into the input panel and you'll get a tidy, indented version in the output panel. Selectors, declarations, and media queries are laid out on their own lines so the rules are easy to scan and review.

Features

  • Format CSS with 2 spaces, 4 spaces, or tab indentation.
  • Preserve declaration order, comments, and existing values exactly.
  • Newline between rules for visual breathing room between selectors.
  • Copy the result or download it as a .css file.

How it works

The tool uses the CSS beautifier from the open source js-beautify library, loaded into your browser on first use. It tokenizes the stylesheet, normalizes whitespace, and writes the result back with your chosen indentation.

Privacy

Your CSS never leaves your browser. The whole tool runs locally as JavaScript on this page, so you can safely paste in-house design system code, third-party stylesheets, or anything else without it touching a server.

Frequently asked questions

Does this tool send my CSS anywhere?
No. Formatting happens entirely in your browser. The js-beautify library is fetched once from a public CDN, but your CSS text is never uploaded.
Does it also minify CSS?
No. This tool only beautifies. For minification, run the CSS through a build step (esbuild, Lightning CSS, clean-css) or a dedicated minifier.
Will it change my CSS values or selectors?
No. The formatter only adjusts whitespace and line breaks. It does not rewrite values, reorder declarations, remove duplicates, or merge rules.
Does it work with SCSS, Sass, or Less?
It works for SCSS and Less because they are mostly CSS-compatible at the token level, so the indentation will be correct. Some preprocessor-specific syntax (mixins, nested rules, indented Sass) may not lay out perfectly. Use your preprocessor's own formatter for the best result.