CSS Beautifier

Format and indent messy CSS instantly

Original CSS

Options

Beautified CSS

Overview

The CSS Beautifier reformats minified, compressed, or inconsistently indented stylesheets into clean, readable CSS — consistent indentation, sorted properties, and clear spacing between rules — so you can actually read, review, and edit it. Paste a minified stylesheet, a bundled CSS file, or messy hand-written CSS, and get formatted output instantly.

What This Beautifier Controls
  • Indentation: 2 spaces, 4 spaces, or tabs, applied through the real js-beautify formatting engine
  • Property sorting: alphabetize declarations within each rule block for a consistent, scannable style
  • Media query sorting: order top-level @media blocks by breakpoint, ascending for min-width and descending for max-width
  • Rule spacing: add a blank line between rules for visual separation, or keep output tight
  • Comment preservation: keep or strip /* ... */ comments during formatting
  • Color normalization: shorten 6-digit hex colors and rgb() values to 3-digit hex shorthand wherever the channels allow it
When You'd Beautify CSS
  • Reading a minified production stylesheet to debug a layout issue in browser DevTools
  • Reformatting CSS pasted from a chat message, PDF, or email that lost its original indentation
  • Standardizing property order and indentation before a code review
  • Making a bundled or generated stylesheet — from a CSS-in-JS build or preprocessor output — readable enough to audit
  • Cleaning up CSS exported from a design tool before committing it
How to Beautify CSS
  1. 1.Paste your CSS into the input editor, or upload a .css file
  2. 2.Choose indentation — 2 spaces, 4 spaces, or tabs
  3. 3.Toggle comment preservation, property sorting, media query sorting, rule spacing, and color normalization as needed
  4. 4.Formatted output appears automatically as you type
  5. 5.Copy the output or download it as a .css file
Edge Cases Worth Knowing
  • Sorting properties alphabetically can separate logically related declarations, like margin and margin-top — review the sorted output before adopting it as a strict style rule
  • Vendor-prefixed properties (-webkit-, -moz-) sort alongside their unprefixed counterparts, which can place a prefixed fallback after the standard property
  • The brace checker flags unmatched { and } as you type, but it is a heuristic scan, not a full CSS parser — it will not catch every kind of invalid syntax
Limitations
  • This is a formatting tool, not a linter — it won't catch invalid property names, browser-compatibility gaps, or selector-specificity conflicts
  • Extremely large stylesheets (multi-MB bundles) may be slow to beautify in the browser — a build-tool-integrated formatter (Prettier, Stylelint --fix) suits large-scale codebase formatting better
  • For enforcing a consistent CSS style across a team, a dedicated tool like Stylelint or Prettier integrated into your editor/CI is more appropriate than ad hoc browser formatting
Need to Go the Other Way?

If you have readable CSS and need to shrink it for production — reducing file size and page load time — use the CSS Minifier instead. It collapses whitespace, shortens colors, and can strip redundant zeros for maximum compression.