Free CSS Beautifier
Format and beautify compressed or messy CSS with proper indentation and line breaks. Makes CSS readable and maintainable. Free, with no sign-up required — everything happens right in your browser, so nothing you enter is sent to a server.
💻 CSS Beautifier
How the CSS Beautifier Works
Paste CSS, choose an indent of 2 spaces, 4 spaces or a tab, and press Beautify CSS. The tool reads the stylesheet in order, protecting comments, quoted strings and url() values so their contents are never altered, then puts each selector, opening brace, declaration and closing brace on its own line with the right indentation. It also adds a space after each colon, a semicolon after the last declaration in a block and a space after commas in selector lists.
Because strings and url() values are set aside first, a data URI such as url(data:image/png;base64,AAA=) stays on one line instead of being split at its semicolon. Rules inside @media and other at-rules are indented one level further. The formatter works with standard CSS. SCSS and Less features such as nesting, mixins and variables with special syntax are not specifically handled, so use a dedicated formatter for those.
Practical Use Cases
- Make a minified stylesheet readable so you can inspect or debug it.
- Apply a consistent indentation style to CSS before committing it.
- Clean up CSS copied from browser developer tools or a code snippet site.
- Check how rules are nested inside media queries.
Tips for Best Results
- Format minified CSS before debugging it. The one-rule-per-line layout makes it far easier to spot the declaration that causes a problem.
- Match your team's indentation, usually two spaces, so diffs in version control show real changes and not whitespace noise.
- Do not use this tool on SCSS or Less sources with nesting if you need exact formatting. Use a formatter built for those languages.