CSS Formatter & Beautifier

Paste CSS or minified CSS, then beautify it with proper indentation or minify it for production.

Features

Beautify / minify toggle
Sort properties
Remove duplicates

How to Use

1. Paste your CSS into the input box on the left.

2. Click Format to beautify, or Minify to compress.

3. Copy the formatted result from the right panel.

About this tool

Minified or hand-edited CSS is hard to review: one long line hides duplicate rules, missing semicolons and overrides. This formatter rebuilds the stylesheet with one declaration per line, consistent indentation of two spaces, four spaces or tabs, while keeping strings, comments and nested blocks such as @media and @supports intact. Minify does the opposite for production, stripping comments and unnecessary whitespace to reduce transfer size. You can paste code, or drag in a .css file, then copy or download the result. Formatting changes layout only — the order and meaning of your rules stay exactly the same, so the cascade behaves as before.

Frequently Asked Questions

Will formatting change how my CSS behaves?
No. The formatter only changes whitespace and line breaks. Selectors, declarations and their order are preserved, so specificity and the cascade work exactly as they did before.
How much does minifying CSS save?
Removing comments and whitespace typically shrinks a hand-written stylesheet by 15–30%. Serving it with gzip or Brotli compression saves much more, so use both for production.
Does it support @media, @supports and nested rules?
Yes. At-rules and nested blocks are indented by level, and their contents are formatted like any other rule, so media queries remain easy to scan.
Are comments kept?
Formatting keeps block comments and places them on their own lines. Minifying removes them, since comments are not needed by the browser.
Does the formatter check my CSS for errors?
It does not validate property names or values. It formats what it receives, so a typo such as colr: red stays in the output; use your editor or a linter like Stylelint to catch mistakes.

Related Tools