How to Format CSS
CSS Formatting
When to Format CSS
Beautify minified stylesheets from production builds, normalize pasted snippets from browser DevTools, or prepare CSS for code review. Consistent indentation makes selectors, media queries, and nested rules easier to scan during debugging and pull request diffs.
Format vs Compress
Use Format for readable output with indentation and line breaks. Use Compress to strip comments and insignificant whitespace only. Formatting does not change how browsers apply rules — only readability changes.
Developer Tips
- Format before diffing CSS changes in pull requests
- Choose 2- or 4-space indent in Tool Settings to match your project style guide
- Fix syntax errors before formatting — malformed CSS may not beautify cleanly
Frequently asked questions
Does formatting change CSS behavior?
No. Whitespace between rules and declarations is not significant to browsers.
Can I choose indentation width?
Yes. Select 2 or 4 spaces in Tool Settings before running the formatter.