Format and beautify CSS
Unminify and beautify CSS: one declaration per line, clean indentation, readable media queries.
0 / 1,000,000 characters · Updates as you type.
Production CSS is usually minified: every rule on one line, no spaces, no line breaks. That is right for speed, but when you need to understand why a button looks wrong on a live site, copy a component's styles from a theme, or review what a framework generated, you need it back in a readable shape. This formatter puts every declaration on its own line, indents rules inside @media, @supports and @layer blocks, and spaces selectors and values consistently.
You choose the indentation (two spaces, four spaces or tabs), whether a selector list such as "h1, h2, h3" is split one selector per line, and whether rules are separated by a blank line. Comments are kept where they are. Custom properties, calc() expressions, gradients with many stops and vendor-prefixed properties come through unchanged apart from spacing, so the stylesheet behaves exactly as before.
The formatting engine is the CSS beautifier from js-beautify (MIT), about 6 KB compressed, downloaded only when you first format something on this page. It does not validate or rewrite your CSS: invalid declarations stay invalid and nothing is reordered or merged. Nothing you paste is sent anywhere, which matters for unreleased designs and client work.
How to use it
- Paste minified or messy CSS into the input.
- Choose the indentation and the layout options.
- Read the formatted stylesheet as you type.
- Copy it, or download formatted.css.
Frequently asked questions
Will formatting change how my site looks?
No. Only whitespace and line breaks change; selectors, properties and values, and their order, stay the same.
Does it work with SCSS or Less?
Plain nesting and variables usually format well because they look like CSS. Advanced syntax such as mixins with complex arguments may not be laid out perfectly.
Can it minify CSS?
This page formats only. Your build tool (for example Lightning CSS, cssnano or esbuild) is the right place to minify, because it also knows your target browsers.
Are comments kept?
Yes, comments stay in place.
Does it check my CSS for errors?
No. It formats whatever you paste. Browser developer tools or a linter such as Stylelint will flag invalid properties.
How do I get the CSS of a live website?
Open the browser's developer tools, find the stylesheet in the Sources (Chrome, Edge) or Style Editor (Firefox) panel, copy it and paste it here. Many browsers also offer their own pretty-print button there.
Related tools
- Format and beautify HTMLBeautify minified or messy HTML with consistent indentation, including inline CSS and JavaScript.
- Format and beautify JavaScriptBeautify minified or messy JavaScript and JSON-like code with your choice of indentation and brace style.
- Format, minify and check XMLPretty-print or minify XML and check that it is well-formed, with the line and column of any error.
- Format, beautify or minify JSONPretty-print or minify JSON with 2-space, 4-space or tab indentation and optional key sorting.
- Convert Markdown to HTMLConvert Markdown to clean, sanitised HTML with a live preview, GitHub tables and task lists.
- Pick colours from an imageClick any pixel to get its HEX, RGB and HSL code, and extract the dominant colour palette.