Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
CSS Formatter

CSS Formatter

Format and beautify minified or messy CSS with clean indentation and one declaration per line.

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.

Built on Prettier with its PostCSS parser, so selectors, properties, media queries, and at-rules are all formatted to a reliable, industry-standard style.

Common Use Cases

Unminify Stylesheets

Expand a one-line minified CSS file into readable rules you can inspect, debug, and edit.

Clean Up Rules

Normalize spacing, indentation, and line breaks across CSS copied from many different sources.

Review & Learn

Make stylesheets from DevTools, tutorials, or generators easy to read before reusing them.

How to Format CSS

1

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.

2

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.

3

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.

4

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.

Everything runs locally. Your stylesheet is formatted entirely in the browser and is never uploaded to a server.

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.

OptionChoicesWhat It Controls
Indent2 · 3 · 4 · 8 spaces · TabIndentation width and character used for nested rules and declarations.
Print Width80 · 100 · 120Target 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.

New to the tool? Click Sample to load a deliberately messy stylesheet and watch it format instantly.

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.

Indent
Input
Output
Error

Paste code on the left to format

|
Paste minified or one-line CSS to expand it into readable, indented rules.
Works with plain CSS, including media queries, keyframes, and at-rules.
Pick 2, 3, 4, 8 spaces or Tab for indentation to match your project.
Adjust print width (80, 100, 120) to control where long values wrap.
Toggle Edit mode to tweak the formatted output before copying or downloading.
Want to learn more? Read documentation →
1/6
Start typing to search...
Searching...
No results found
Try searching with different keywords