Beautify CSS in Your Browser
The CSS Formatter turns minified or messy stylesheets into clean, well-indented CSS in real time — right in your browser. Paste a compressed production stylesheet or a tangle of hand-written rules and the formatted result appears instantly in the right-hand panel, with one declaration per line and consistent spacing.
Common Use Cases
Unminify Stylesheets
Clean Up Rules
Review & Learn
How to Format CSS
Paste Your Stylesheet
Type or paste CSS into the Input panel on the left. You can also Upload a .css file, or click Sample to load an example.
See Instant Output
The formatted, syntax-highlighted stylesheet appears automatically in the right panel as you type. Line numbers and a live size counter make large files easy to navigate.
Adjust Options
Choose the indent (2, 3, 4, 8 spaces or Tab) and set the print width to control how long lines wrap. The output re-formats immediately.
Copy or Download
Click Copy to grab the result, or Download to save it as a .css file. Use Edit to tweak the output by hand before exporting.
Features & Options
Formatting Options
Prettier's CSS formatting is largely automatic, with two controls that adapt the output to your preferences. Each change re-formats the result instantly.
| Option | Choices | What It Controls |
|---|---|---|
| Indent | 2 · 3 · 4 · 8 spaces · Tab | Indentation width and character used for nested rules and declarations. |
| Print Width | 80 · 100 · 120 | Target line length before long values and selector lists wrap. |
What Gets Formatted
Selectors & Declarations
Consistent indentation, one declaration per line, and tidy spacing around colons and braces.
Media Queries & At-Rules
Nested @media, @keyframes, and other at-rules are indented and aligned correctly.
Built-In Tools
Real-Time Formatting
Output updates as you type, with syntax highlighting and line numbers.
Upload & Download
Load a local .css file or export the formatted result with one click.
Editable Output
Switch the result panel to edit mode to make manual tweaks before copying.
Frequently Asked Questions
Is my CSS sent to a server?
No. All formatting happens locally in your browser. Your stylesheet is never uploaded, logged, or stored, so it is safe to format proprietary or unreleased CSS.
What formatting engine does it use?
It uses Prettier with its PostCSS parser, the same formatter widely used to keep stylesheets consistent in real projects. The output follows a dependable, conventional style.
Does it handle media queries and keyframes?
Yes. Nested at-rules such as @media and @keyframes are indented and aligned correctly, along with standard selectors and declaration blocks.
Can I customize the output?
Yes. Set the indent size and the print width from the toolbar to control indentation and where long lines wrap. The output re-formats immediately so you can preview the change.
Does it minify CSS too?
This tool is a beautifier — it expands and indents CSS for readability rather than compressing it. To shrink a stylesheet for production, use a dedicated CSS minifier instead.
What happens if the CSS is invalid?
If the parser cannot understand the input, the tool shows an error message describing the problem instead of producing broken output. Fix the reported issue and the formatted result reappears.
No comments yet. Be the first to comment!