Free CSS Beautifier
Pretty-print minified CSS with consistent indentation, or minify it. Optional alphabetical property sorting for predictable diffs.
Drop a file here, or click to browse
CSS Β· processed on your device
or press Ctrl+V to paste from your clipboard
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.
- 1Character-level tokenizationThe 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.
- 2Block and declaration separationWhen 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.
- 3Property sorting and indentationDeclarations 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.
- 4Instant in-browser outputResults 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
HTML Beautifier & Minifier
Pretty-print or minify HTML with proper nesting indentation. Preserves content inside <pre>, <script>, <style> blocks.
SQL Formatter & Beautifier
Pretty-print SQL queries with proper indentation, configurable keyword case, and line breaks on major clauses. Works with any SQL dialect.
CSS Minifier & Beautifier
Minify CSS to reduce file size or beautify minified CSS for readability. Instant, in your browser.