Skip to main content
Preparing workspace

CSS Beautifier

Re-indent minified CSS with 2, 4 or 8 spaces, comments kept and blank lines between rules optional. Copy it or download styles.beautified.css.

Still loading. If the tool doesn’t appear, reload this page.

About this tool

CSS Beautifier

Format, beautify, and clean minified or messy CSS code with options to adjust tab indentation size and copy output.

CSS Beautifier re-indents minified or messy stylesheets by normalising the spacing around braces, semicolons, colons and commas, then re-indenting each nesting level with 2, 4 or 8 spaces. It is for anyone who has a stylesheet collapsed onto one line — from a build output, a CMS field, or a copied snippet — and needs it readable again. Blank lines between top-level rules can be switched on or off, and the result copies to the clipboard or downloads as styles.beautified.css.

How to use CSS Beautifier

  1. Paste your minified or messy CSS into the Input CSS Code box, or press Load Sample CSS to drop in a deliberately messy example that includes a media query.

  2. As soon as the box has content a Formatting Configuration panel appears: choose 2 Spaces, 4 Spaces or 8 Spaces for Indentation Size, and use the Selector Spacing button to switch between 'Add blank lines between rules' and 'Keep rules compact'.

  3. Press Beautify CSS Code to fill the Beautified CSS Code panel, then use Copy Code for the clipboard or Download (.css) to save it as styles.beautified.css — Clear Input empties both boxes and starts over.

Why use CSS Beautifier

  • Three indent widths, chosen by button

    2, 4 or 8 spaces applied per nesting level, so nested rules inside a media query line up at the depth your project already uses.

  • Rule spacing you control

    A single toggle switches between a blank line after every top-level rule and a compact layout with no gaps, which matters when the file is long.

  • Sample CSS built in

    A deliberately messy sample with a media query loads in one click, so you can see exactly how the formatter treats nesting before pasting your own file.

Common use cases

  • You copied a compiled stylesheet out of DevTools and it is one continuous line — you need it expanded before you can find the rule that is overriding your layout.
  • A teammate's CSS uses 4-space indentation and yours uses 2, so you run their file through at 2 spaces before pasting it into the shared stylesheet to keep the diff clean.
  • You are preparing CSS for a tutorial or code review and want generous blank lines between rules so each block reads as a separate example.

Frequently asked questions

Which mode options does this tool cover?

1 plus the general beautify mode: Formatter. Pick one at the top of the tool; the page link updates (for example ?v=formatter) so you can bookmark or share that exact view.

Link to answer
How do I make minified CSS readable again?

Paste it in and beautify — the formatter puts each declaration on its own line, moves opening braces onto the selector line, and indents block contents by your chosen width. It handles nested blocks such as media queries by tracking brace depth, so inner rules are indented one level deeper.

Link to answer
What indentation sizes are available?

2, 4 or 8 spaces. The tool indents with spaces rather than tab characters, so the output looks identical in every editor regardless of the reader's tab width setting.

Link to answer
Are my comments preserved?

Yes. Block comments in `/* ... */` form are kept and pushed onto their own line, so section headings written as comments survive the reformat instead of being stripped like a minifier would.

Link to answer
Can I save the result as a file?

Yes — the formatted output downloads as `styles.beautified.css` with the text/css MIME type, or copies to the clipboard in one click. The file is generated in the browser, so nothing is uploaded.

Link to answer