CSS Formatter and Beautifier
Paste minified or messy CSS to pretty-print it instantly. Each selector goes on its own line, declarations are indented one per line, and spacing around colons is normalized.
How to format CSS
- Paste your CSS into the input box.
- Pick an indent size: 2 spaces, 4 spaces, or a tab.
- Copy the formatted CSS or download it as a .css file.
Examples
Beautify a minified rule
a{color:red;font-weight:bold}a {
color: red;
font-weight: bold;
}Nested media query
@media (max-width:600px){body{margin:0}}@media (max-width:600px) {
body {
margin: 0;
}
}Frequently asked questions
Is my CSS sent to a server?
No. Formatting runs entirely in your browser with JavaScript, so your CSS never leaves your device.
How does the formatter decide where to break lines?
Each selector or at-rule prelude gets its own line with the opening brace, every declaration sits on its own indented line ending in a semicolon, and the closing brace drops to its own line. A blank line separates top-level rules.
Does it handle nested at-rules like @media?
Yes. Rules inside @media, @supports and similar blocks are indented one extra level so the nesting stays readable.
Will it change my property values or colors?
No. It only normalizes whitespace and layout. Values, colors, quoted strings and comments are kept exactly as written.
Can I run it on already-formatted CSS?
Yes. The formatter is idempotent, so reformatting tidy CSS returns the same result without piling on extra blank lines.
What indentation can I choose?
Two spaces, four spaces, or a tab. Pick whatever matches your project's code style.
Related tools
CSS Gradient Generator
Build linear and radial CSS gradients with a live preview. Pick colors, set the angle and copy ready-to-paste background code for your site.
SQL Formatter
Format and beautify SQL online. Put clauses on their own lines, indent the column list and uppercase keywords. Fast and runs in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.