Free CSS Formatter & Minifier

Free CSS formatter and minifier. Turn compressed CSS into readable rules with one property per line, or minify stylesheets by removing comments and whitespace.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideHow to Read and Edit Minified CSS (and Minify It Again) →

About the CSS Formatter tool

Production CSS is normally minified into a single line, and stylesheets copied from browser dev tools, themes or plugins are often inconsistently indented. This CSS formatter turns any stylesheet into neat, readable code with one declaration per line, clear spacing around selectors and properly indented @media and other nested blocks.

Beautifying is powered by js-beautify, with your choice of 2 spaces, 4 spaces or tabs. When you need the opposite, switch on “Minify”: comments are removed, line breaks disappear, spaces around braces, semicolons and commas are dropped, spaces after colons go, and the final semicolon before each closing brace is removed. Strings such as content: "New: " and spaces inside calc() are kept exactly, and selector spacing is never changed, so the minified CSS behaves the same as the original. It is a careful whitespace-and-comment minifier; it does not merge rules or shorten colours like a full optimiser.

All of this happens in your browser without uploading your stylesheet, so theme code and client projects stay private. Results update live, so you can compare formatted and minified output instantly.

How to use CSS Formatter

  1. Paste CSS into the “CSS input” box, open a .css file with “Open file”, or click “Load sample”.
  2. Choose an “Indent size”: 2 spaces, 4 spaces or tab.
  3. Leave “Minify” off to beautify, or turn it on to compress the stylesheet.
  4. Review the output, which updates as you type.
  5. Click “Copy” or “Download” to save the file (downloads are named -formatted.css or .min.css).

Features

Readable formatting

One property per line with consistent indentation, including inside @media blocks.

Safe minification

Removes comments and whitespace without altering strings, calc() spacing or selectors.

Indent choice

2 spaces, 4 spaces or tabs to match your codebase.

Works with SCSS-like input

Nested rules and variables usually format fine because the formatter is syntax-tolerant.

In-browser only

Your stylesheet is processed locally and never uploaded.

When to use it

  • Read a minified stylesheet from a live site to understand how it is styled.
  • Clean up CSS copied from browser dev tools or an online generator.
  • Minify a small stylesheet before inlining it into an HTML page or email.
  • Standardise indentation before a code review.
  • Prepare CSS snippets for tutorials and documentation.

Frequently asked questions

Will minified CSS work the same as the original?

Yes. The minifier only removes comments and whitespace in places where it has no meaning, and it leaves strings and selector spacing alone.

Does it remove unused CSS or merge rules?

No. It does not analyse your HTML or restructure rules; it only removes comments and whitespace.

Can I format SCSS or Less?

Simple SCSS and Less files usually format well, but features specific to those languages, like mixins with complex syntax, may not be laid out perfectly.

Why is there no error message for invalid CSS?

js-beautify is tolerant and formats whatever it receives, so it does not report CSS syntax errors. Check odd indentation in the output for missing braces.

Is my CSS sent to a server?

No. Everything runs in your browser.

Why keep a .min.css and a formatted version?

Serve the minified file to visitors for faster loading, and keep the formatted file in your source code so it stays easy to read and edit.

Related tools