CSS Formatter & Minifier
FormatEverything runs locally in your browser — nothing is uploaded
Expand a minified stylesheet into something readable: every declaration gets its own line, selector lists break at the commas, @media blocks and nested rules indent a level deeper, and empty rules collapse onto one line. Minify mode does the reverse, removing whitespace only at structural positions and dropping the redundant semicolon before a closing brace. Spaces that carry meaning, such as in margin: 0 auto or before the colon in a :hover, are left alone because removing them changes what the rule means.
Features
- The output is syntax-highlighted, with keywords, strings and comments colour-coded
- Expands rule blocks: selector on its own line, one declaration per line, closing brace aligned with the selector
- Breaks selector lists at commas while commas inside values (font stacks, rgba()) stay put
- Collapses empty rules onto a single line, as in a {}
- Normalises declaration colons to color: red while leaving pseudo-class colons such as &:hover and a:hover alone
- Structural characters inside strings, comments and url() are ignored, so content: "}" and data URIs cannot break a rule apart
- Data URIs are treated as one unit, so the semicolon inside one never splits a declaration in two
- Minify removes structural whitespace, the redundant semicolon before } and ordinary comments
- Keeps copyright comments written as /*! ... */
- No syntax validation: unbalanced braces are indented as best they can rather than rejected
How to use
- Paste your CSS into the input box
- Pick the mode and indentation
- Press Ctrl/⌘ + Enter or click Run
- Click Copy to take the result
FAQ
- Does minifying remove the space in margin: 0 auto?
- No. Only whitespace around { } ; , and : is removed. "0 auto" is two values, and dropping a space would turn it into an invalid declaration, so those spaces are always kept.
- Will a :hover be minified into a:hover?
- No. The space before the colon is a descendant combinator, and a :hover and a:hover are two entirely different rules. Minify keeps it.
- Does it handle CSS nesting?
- Yes. Pseudo-class colons and declaration colons are told apart by what follows them: only a colon followed by ; or } is treated as a declaration colon, so a selector is never rewritten into the invalid &: hover.
- Is my CSS uploaded anywhere?
- No. Everything runs in your browser memory, the page makes no network requests, and it works offline.
Related tools
JS Minify & Beautify
FormatMinify JavaScript (comments and whitespace stripped, /*! licences kept) or beautify it by re-indenting on braces and semicolons. Nothing is uploaded.
HTML Formatter
FormatFormat HTML online by tag level, keeping text and inline tags on one line and script or pre content untouched. Runs locally, with nothing uploaded.
Color Converter
ConvertConvert between HEX, RGB, HSL, HWB, CMYK, Lab and OKLCH, with colour temperature, inverse, complement, nearest ANSI colour and WCAG contrast.
JSON Formatter
FormatFormat, validate and minify JSON in a collapsible tree with syntax highlighting and line numbers. Search, edit, delete or convert to Python dicts.
JSON to Code
FormatTurn JSON into TypeScript interfaces, Go structs, Java classes or Rust structs, with missing keys marked optional. Runs locally in your browser.
SQL Formatter
FormatFormat SQL online: one clause per line, consistent keyword case, subqueries indented deeper. Minify strips comments and extra whitespace, all locally.