CSS Formatter
About this tool
About CSS Formatter
Grab a minified stylesheet from a production site, a theme or a component library and make it readable again: one declaration per line, rules separated by a blank line, selectors in a group split onto their own lines, and media queries, @supports blocks and keyframes indented properly. Choose 2 spaces, 4 spaces or tabs, an optional line width, and whether to keep blank lines. It also works on SCSS and Less that stays close to plain CSS syntax. Switch to Minify to go the other way: comments and unnecessary whitespace are removed and the last semicolon in each block is dropped, while strings, url() paths, calc() expressions and descendant selectors like .menu :hover are kept exactly, so the stylesheet behaves the same. Licence comments starting with /*! can be kept. The tool runs entirely in your browser, so private design systems and unreleased styles never leave your device. Optional AI help can explain a stylesheet, including selectors and specificity, using your own AI key; only the CSS is sent to your provider.
Built and maintained by Abhi JainUpdated
How to Format CSS
- 1
Paste or open CSS
Paste CSS into the left pane, open a .css file, or click Sample.
- 2
Choose Beautify or Minify
Under Mode keep Beautify and pick Indent and Wrap at, or choose Minify and decide whether to keep /*! licence */ comments.
- 3
Copy or download
Copy the result or download it as a .css file.
CSS Formatter: questions and answers
How do I unminify CSS?
Paste the minified CSS and keep Mode on Beautify. Each rule and declaration is put on its own line with indentation. Comments that were removed during minification cannot be restored.
Is it safe to minify CSS this way?
Yes. Only comments and whitespace that CSS ignores are removed, plus the optional last semicolon in a block. Spaces that matter, such as those inside calc() and before a pseudo-class in a descendant selector, are kept.
How much smaller does minified CSS get?
It depends on how many comments, blank lines and how much indentation the stylesheet has; an already minified file barely changes. The tool shows the exact size and saving. Serving the file with gzip or Brotli compression shrinks it much further.
Does it work with SCSS or Less?
Beautifying works for most SCSS and Less because the syntax is close to CSS, including nesting. It does not compile them to CSS.
Is my CSS uploaded?
No. Everything happens in your browser.
Can AI explain my CSS?
Yes, if you connect your own AI key in AI settings. The AI button sends the CSS in the input straight from your browser to your provider and returns a walkthrough of what the rules do and anything likely to be a mistake. Formatting and minifying never use AI.
Ready-made CSS Formatter presets
Related Tools
- HTML FormatterBeautify messy HTML with clean indentation, or minify it for production.
- JavaScript FormatterBeautify minified JavaScript, or minify it safely by removing comments and whitespace.
- HTML, CSS & JS PlaygroundWrite HTML, CSS and JavaScript and see a live, sandboxed preview with a console.
- CSS Gradient GeneratorLinear, radial and conic CSS gradients with a live preview.