Smaller CSS with comments, whitespace and empty rules removed safely
CSS Formatter
Turn a one-line stylesheet into readable, consistently indented CSS without changing what it does.
Loading tool…
How to use css formatter
Paste CSS, drop a .css file on the box or load the sample.
Choose the indent and whether each selector in a list gets its own line.
Read the formatted CSS on the right; it updates as you type.
Copy it or download it. Download is only offered once the output has passed its check.
What this tool does
- Handles nested blocks such as @media, @supports and native CSS nesting at any depth.
- Leaves strings, comments and unquoted url(...) values exactly as written, including semicolons and braces inside them.
- Puts one declaration per line, adds a space after each colon and comma, and spaces out child and sibling combinators.
- Reports the line of an unclosed block, a stray } or an unclosed string or comment instead of guessing.
How the result is verified
The formatted output is parsed again and reduced to its minimal form, which must match the minimal form of your input exactly. If it does not, the download stays switched off.
Frequently asked questions
Will formatting change how my page looks?
No. Only whitespace changes. The tool proves it on every run by shrinking both the input and the output to minimal CSS and comparing them byte for byte.
Can it format the CSS inside an HTML file?
Use the HTML formatter for that: it formats the markup and, optionally, the CSS inside each style block with the same engine.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Indent HTML neatly while keeping pre, textarea and script content intact
Live CSS editor with HTML to style, presets and phone width preview
Beautify or minify JSON with your choice of indentation
Compare two texts line by line with changed words highlighted