Web & Developer Utilities100% Client-Side

CSS Formatter and Prettifier

When a CSS rule comes from a build output or an example, its selector and declarations may be squeezed onto one line. Use this formatter to put the declarations on separate lines and indent the blocks. Choose two or four spaces to match the surrounding file. The output is useful for inspecting ordinary rules and simple nesting, and you can compare it with the original before copying it into a stylesheet.

Configuration Options

Number of spaces per property indentation.

Input
65 chars•1 lines
Output

Reverse tool

CSS Minifier

Compact CSS by removing comments and tightening spaces around selectors and declarations. Copy shorter stylesheet snippets for fixtures, demos, or review.

Open CSS Minifier

How to Use the CSS Prettifier Online

  1. 1Paste a selector with its full declaration block, or include a small set of related rules that you want to read together.
  2. 2Select two or four spaces under Indentation Spacing. Change the selection to preview the indent used at each level.
  3. 3Read the declaration lines under the selector. For a media query, look for the extra indent on the rules grouped inside it.
  4. 4Copy the formatted result for a review or an example. When replacing source, compare any strings, comments, and values that rely on their original spacing.

Input & Output Examples

The selector opens a block and each declaration appears on its own indented line.

Input Sample
.card{padding:1rem;color:#123}
Expected Output
.card {
  padding: 1rem;
  color: #123
}

The media query and its inner rule are shown at different indentation levels.

Input Sample
@media (min-width:40rem){.grid{display:grid;gap:1rem;}}
Expected Output
@media (min-width: 40rem) {
  .grid {
    display: grid;
    gap: 1rem;
  }
}

Practical Developer Workflows

  • Expand a generated rule while tracking down which declaration controls the spacing or color of a component.
  • Prepare a small stylesheet for a code review so each affected property can be discussed on its own line.
  • Inspect the conditional styles inside a media query before comparing them with the default declarations.

Zero Server Uploads & Complete Privacy

Runs 100% in your browser; no data is uploaded to any server.

Notice a bug, calculation error, or outdated info?

Let us know directly so our engineering team can fix it.

Frequently Asked Questions

Yes. Choose two or four spaces in the workspace. The setting affects the indentation of the output at each level, so declarations and nested rules are easier to distinguish when you paste them into a document or review.

Explore Other Tools

12 suggested tools

View all tools