CSS Beautifier
This free online CSS beautifier turns cramped, machine-generated stylesheets into readable, consistently formatted CSS the moment you paste it.
How to use
- Paste your minified or messy CSS into the editor below.
- Pick Beautify to re-indent the stylesheet, or Minify to strip comments and whitespace for production.
- Toggle "One selector per line" to control how comma-separated selector lists are laid out.
- Broken input reports the exact line and column; fix it and the result updates instantly.
Frequently asked questions
What is the difference between Beautify and Minify?
Beautify re-indents for reading: one declaration per line, two-space indentation, a space before each brace, and selector lists on separate lines if you want. Minify prepares CSS for transport: comments and whitespace are removed and each block keeps no trailing semicolon. Both modes accept the same input and never reorder your rules.
What does "conservative minification" mean?
The minifier only removes comments and whitespace, drops the final semicolon of each block, and strips leading zeros from standalone numbers (0.5 becomes .5). It deliberately does not merge or shorten colors — #ffffff stays #ffffff — and it never rewrites values whose meaning could shift, so the minified sheet behaves exactly like the original.
Are comments preserved?
In Beautify mode every comment is kept and placed on its own line. In Minify mode regular comments are removed, while legal comments that start with /*! are preserved, following the common convention for license and attribution notices.
Will data URIs or quoted font names be cut apart?
No. The parser is parenthesis- and quote-aware, so the semicolons and colons inside url(data:image/png;base64,…) stay in the value, and a font family like "Foo; Bar" is treated as one string. Only real declaration boundaries are re-formatted.
What happens if my CSS has a syntax error?
The tool fails fast with an English message that names the exact line and column of the problem — an unterminated string or comment, a stray closing brace, a missing colon — and shows no partial output, so a broken sheet can never quietly turn into a subtly different one.
Is my CSS uploaded anywhere?
No. Parsing, beautifying and minifying all run locally in your browser tab; the stylesheet never leaves your device, which makes the tool safe for private or unreleased production styles.
Related tools
About this tool
This free online CSS beautifier turns cramped, machine-generated stylesheets into readable, consistently formatted CSS the moment you paste it. It offers two modes with one parser. Beautify lays every declaration on its own line with two-space indentation, puts a space before each opening brace, drops redundant semicolons and can split comma-separated selector lists across lines (one toggle). Minify strips comments and whitespace, removes the last semicolon of each block and applies only conservative micro-compression such as turning 0.5 into .5 — it never renames or merges colors, so #ffffff stays #ffffff and nothing "almost equivalent" slips into production. The hand-written parser understands quoted strings, comments, nested at-rules like @media and @keyframes, and values such as url(data:image/png;base64,…) where a semicolon belongs to the data instead of ending the declaration. If the stylesheet is genuinely broken, the tool fails loudly with the exact line and column instead of printing a guessed half-result. Everything runs locally in your browser: your CSS is never uploaded, stored or logged.