Frontend ToolsA little help for every day

Search by name or task, such as JSON or percentage.

Frontend Tools

CSS Beautifier and Formatter

Turn minified CSS into readable code: one declaration per line, nested and @media rules indented, selector lists split, and strings and data URIs left intact.

View all tools
ResultUpdates as you type
body {
  margin: 0;
  font: 16px/1.5 "Helvetica Neue", Arial, sans-serif;
}

div :first-child {
  margin-top: 0;
}

@media (max-width: 600px) {
  .nav a:hover,
  .nav a:focus {
    color: #1a73e8;
    background: url(data:image/png;base64,iVBORw0KGgo=) no-repeat;
  }
}

.card {
  padding: 16px;

  &:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  }
}

How to use CSS Beautifier and Formatter

Paste CSS into the box and the formatted result appears next to it. Choose the indent, whether each selector in a list gets its own line and whether rules are separated by a blank line, then copy.

  1. Paste your CSSPaste minified or messy CSS, including @media blocks and native CSS nesting.
  2. Pick the layout optionsChoose 2 spaces, 4 spaces or Tab, split selector lists onto separate lines and add blank lines between rules.
  3. Check and copyIf the opening and closing braces don't balance, a warning appears; otherwise copy the result.

What formatting changes

body{color:red;margin:0} becomes four lines: the selector with an opening brace, color: red; and margin: 0; indented beneath it, and a closing brace. A space follows each colon and comma, @media (max-width:600px) becomes @media (max-width: 600px) with its rules indented a level deeper, and combinators gain spaces, so a>b+c reads a > b + c. Comma-separated selectors such as .nav a:hover, .nav a:focus can each take their own line, and nested rules such as &:hover inside .card are indented under their parent.

What is deliberately left alone

Strings and url() contents are copied as they are, so a data:image/png;base64 URI is not split at its semicolon. The space in div :first-child is a descendant combinator and is kept, because div:first-child means something else. Brackets in :nth-child(2n+1) get no extra spaces, custom property values starting with -- are only trimmed, and comments stay. Formatting does not validate property names or values, so a typo stays a typo; the only check is a count of opening and closing braces.

Accuracy and data handling

After adding generated code to a project, test it in the target browsers and responsive sizes. The calculation runs in your current browser; the tool code does not send the input to a processing API.

Often Used Together

Next step

FAQ

Does beautifying CSS change how the page looks?

No. Only whitespace, line breaks and indentation change. Meaningful spaces in selectors, strings and url() values are kept, so the rules behave exactly as before.

Does it support @media and CSS nesting?

Yes. @media, @supports and other block at-rules, as well as native nested rules written with &, are indented level by level.

How is this different from a CSS minifier?

A beautifier adds whitespace for reading and editing, while a minifier strips whitespace and comments to make the file smaller for production. Use the CSS Minifier on this site when you're ready to ship.

More Frontend Tools

Related tools