Part of Code & data tools
CSS formatter: beautify and minify stylesheets online
Use this for styles pasted from DevTools, legacy CMS exports, or teammate handoffs—not as a replacement for PostCSS, Sass, or your production bundler.
How to use this converter
- Paste CSS—from a single rule to an entire stylesheet.
- Choose indent size and click Format to expand nested rules.
- Click Minify to compress for inline experiments or size checks.
- Copy the output into your editor; run your usual linter before committing.
Selectors, nesting, and at-rules
Formatted CSS groups declarations under each selector with consistent indentation. `@media`, `@supports`, and `@keyframes` blocks nest visually so you can spot unclosed braces quickly. Modern nested syntax from preprocessors may paste as flat CSS—formatting still helps even if nesting was already compiled.
Custom properties (`--token`) and `calc()` expressions are preserved verbatim; the formatter does not evaluate math or resolve variables.
What minify removes—and what it keeps
Minify strips most comments and collapses whitespace between tokens. License comments required for third-party libraries may be removed—keep originals in source control. Minified CSS is harder to debug in DevTools; beautify again before editing if you inherited a one-line file from a CDN.
Typical workflow with HTML and SCSS
Extract a `
Before and after examples
| Original | Converted | Notes |
|---|---|---|
| .card{padding:1rem}.card h2{margin:0} | Multi-line .card rules | Minified input |
| @media (min-width:48rem){.nav{display:flex}} | Indented @media block | Responsive rule |