Skip to main content

Free CSS Beautifier

Pretty-print minified CSS with consistent indentation, or minify it. Optional alphabetical property sorting for predictable diffs.

Works offline once loaded

Drop a file here, or click to browse

CSS Β· processed on your device

or press Ctrl+V to paste from your clipboard

Browse files
Beautified CSS
Output will appear here…

Common uses

  • Debug Production CSSView minified CSS from production sites in a readable format to find and reverse-engineer styling.
  • Enforce Team CSS StyleRun team-submitted CSS through a consistent beautifier so diffs are about content, not formatting.
  • Format Vendor-Prefixed CSSVendor-prefixed CSS (autoprefixer output) often has lots of -webkit-, -moz-, -ms- variants. Format to inspect.
  • Learn from Pro CSSStudy CSS from famous design systems by formatting their compiled output.
  • Format CSS for Bug ReportsWhen filing CSS bugs, formatted CSS is much easier for reviewers to read and understand.

How It Works

This tool formats CSS using a hand-written recursive parser built directly into the page β€” no third-party library, no server call. The parser walks your CSS character by character, correctly handling quoted strings, url() values, nested at-rules, and comments that would confuse simpler regex-based approaches.

  1. 1
    Character-level tokenization
    The walkCss function scans the raw input one character at a time, tracking quote state and parenthesis depth so that semicolons or braces inside url(), string values, or comments are never mistaken for structural delimiters.
  2. 2
    Block and declaration separation
    When the scanner finds a top-level opening brace, it extracts the prelude (the selector or at-rule keyword) and recursively processes the block body β€” which itself may contain nested rules (@media, @supports, native CSS nesting) handled at a deeper recursion depth.
  3. 3
    Property sorting and indentation
    Declarations within each block are collected into a run, then optionally sorted alphabetically by property name before being written out with the chosen indent width (2 or 4 spaces). Minify mode skips whitespace entirely and strips comments.
  4. 4
    Instant in-browser output
    Results appear as you type via a useMemo hook β€” nothing is sent anywhere. The formatted or minified CSS can be copied to the clipboard or downloaded as a .css file, and the panel shows the size difference compared to the original.

Related Tools

Frequently Asked Questions