Skip to main content
KalkuNet

CSS Formatter — Turn One-Line Stylesheets into Indented Rules

Expand compressed CSS rulesets into cleanly indented selector properties.

Runs in your browserDeveloper · Formatters, Minifiers & Code Builders
Indentation:

5 rules and blocks, 10 declarations.

  • The code is read token by token under CSS Syntax Level 3: quoted strings, unquoted url(…) values (data URIs with ; and # included), escapes, calc(), custom properties --x and var() values are never cut or changed.
  • The output only changes layout and indentation, not the content, and is tested to stay equivalent to the original.

When to use the CSS Stylesheet Beautifier & Prettifier

  • Reading built CSS

    CSS minified by a framework or a WordPress theme is hard to read. This tool puts every declaration on its own line, spaces the rules apart and splits comma-separated selectors one per line so they are easy to follow.

  • Read token by token, not cut at semicolons

    Simple formatters cut the code at every semicolon, which also cuts data URIs such as url(data:image/svg+xml;charset=utf8,…). Here the code is read under CSS Syntax Level 3, so strings, url(), escapes and comments stay whole.

  • Media queries, keyframes and nesting

    @media, @supports, @font-face and @keyframes blocks and CSS Nesting rules are indented level by level. Custom properties such as --brand and var() values are written exactly as they were, because browsers use their content verbatim.

  • Tested equivalent to the original

    The output is tested with esbuild's CSS minifier: the original and the formatted code minify to exactly the same text, the pdf.js and Tailwind style sheets included. So no rule, selector or value changes.

Frequently asked questions

Are comments kept?

Yes. Comments between rules and declarations stay in the formatted output.

Which indentation can I choose?

Two spaces, four spaces or a tab, to match your project's style rules.

Are values such as 0.50 changed?

No. The formatter only arranges the layout; values are written as they were. Use the CSS minifier for shorter forms.

Is my code uploaded?

No. Everything runs in your browser.

Learn more