How to Use css-prettifier
- Paste minified or messy CSS into the input area.
- Click Prettify to add proper indentation, newlines, and spacing.
- Adjust indentation style (2 spaces, 4 spaces, or tab) using the options.
- Copy the formatted CSS for editing, review, or documentation.
Minified CSS from a build tool or CDN is deliberately compressed into a single line, making it unreadable for debugging or inspection. CSS Prettifier reformats it with consistent indentation, one property per line, and a selector-per-line style that matches most CSS linting conventions — making hand-editing, code review, and learning from existing stylesheets practical.
Prettified vs Minified: The Trade-off
Prettified CSS uses 3–5× more bytes than minified CSS but is essential for human work. Modern development workflows handle this automatically: you write in prettified source, version control stores the source, and the build pipeline minifies for production. This tool handles the reverse direction — taking production CSS (for inspection or modification when source is unavailable) and making it human-readable again.
- Consistent indentation and one-property-per-line formatting
- Configurable indentation: 2 spaces, 4 spaces, or tabs
- Preserves comment blocks — useful for copyright notices and section headers
- Also minifies: toggle Minify mode for the reverse operation
Frequently Asked Questions
Can I use this to understand someone else's CSS?
Yes. Paste any minified CSS from a production site's stylesheet and prettify it to read the rules. Be aware that this is typically a violation of the site's terms of service if you use the code commercially.
Does prettifying change the CSS?
No — formatting adds whitespace, which the CSS parser ignores. The specificity, cascade order, and applied styles remain identical. The parsed result is byte-for-byte equivalent.
What is the standard CSS indentation style?
There is no single universal standard, but the most common convention is 2 spaces, a single space between selector and opening brace, each property on its own line, and the closing brace on its own line at the same indent level as the selector.
Does it handle @media queries and nested rules?
Yes — media queries, @keyframes, @supports, and other at-rules are indented correctly, with their nested rules indented one additional level.
See also the CSS Minifier, HTML Formatter, and JSON Formatter.