CSS Formatter
You open a production stylesheet in DevTools and everything is on one line. This formatter unpacks minified CSS into readable form: one declaration per line, two-space indentation and a blank line between rules. It works on raw CSS, the output of Sass or PostCSS, and the CSS inside inline <style> blocks. The CSS you paste is sent to our server to be formatted and is carried in the page link as you move between the steps of the tool. Block comments are removed during formatting.
How to format CSS
-
1
Paste the CSS
Single-line minified, partially formatted or already pretty. The parser does not care.
-
2
Format
Press Format CSS. Every declaration moves to its own line with two-space indentation, and a blank line separates the rules.
-
3
Review
Check the output. Property order is preserved, but block comments are removed.
-
4
Copy
Copy the formatted CSS to your clipboard and paste it back into your project.
Before and after
Input (minified):
.btn{background:#2563eb;color:#fff;padding:.5rem 1rem;border-radius:6px}.btn:hover{background:#1d4ed8}
Output (formatted):
.btn {
background: #2563eb;
color: #fff;
padding: .5rem 1rem;
border-radius: 6px;
}
.btn:hover {
background: #1d4ed8;
}
What the formatter does
| Behaviour | Value |
|---|---|
| Declarations | One per line, indented with two spaces |
| Blank line between rules | 1 |
| Opening brace | On the same line as the selector |
| Closing brace | On its own line |
| Property order | Preserved, never re-sorted |
| Block comments | Removed during formatting |
What the formatter removes
/* This comment is removed when you format */
.button { background: #2563eb; }
Block comments (/* ... */) are stripped from the output. If you need them, keep a copy of the original file before formatting.
Nested rules (Sass / modern CSS nesting)
The formatter indents nested rules according to their depth:
.card {
padding: 1rem;
& .title {
font-weight: 600;
}
&:hover {
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
}
Sass/Less syntax without & is also tolerated. Sass-specific at-rules such as @mixin, @include and @extend pass through intact but are not reformatted deeply. For full Sass formatting, use a Sass-aware tool like Prettier.
When not to format
- In production: minify, do not format. Formatted CSS is 2-3x larger than minified.
- Before diffing: format both sides. Diffing a minified file against a pretty one produces unreadable diffs.
- Inside a build pipeline: let Prettier or your framework’s formatter handle consistency. Use this tool for one-off cleanup.
Frequently Asked Questions
It handles standard CSS and CSS Nesting (the 2023 spec). Sass-specific syntax like @mixin, @include, @extend and variables with $ is passed through intact but not reformatted deeply. For full Sass formatting, use a Sass-aware tool like Prettier.
Yes. Formatting runs on our server, so the CSS you paste is sent with each format request, and it is carried in the page link while you move between the steps of the tool. It is not saved to an account or reused afterwards.
No, if it is syntactically valid. Whitespace in CSS is insignificant outside of values, and the formatter only rearranges whitespace and line breaks. Declaration order and the values themselves are preserved.
Yes. Copy the CSS from inside the <style> tags, paste it, format, and paste it back. The formatter works on CSS only, so paste the CSS content rather than the surrounding HTML.
The formatter strips block comments (/* ... */) to keep the output uniform. If you want to keep them, save a copy of the original CSS before formatting.
Related Tools
ASCII Table Reference
Full ASCII table from 0 to 127 with decimal, hex, octal, binary, standard names and HTML numeric-reference notation, including NUL, LF and DEL.
HEX Color Picker
Pick or enter a HEX colour and get RGB, HSL, approximate CMYK, relative luminance and contrast ratios against white and black.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
HTML Character Reference
Searchable list of HTML entities, their named and numeric codes, and a one-click copy for special characters and symbols.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
JSON Formatter
Paste JSON to pretty-print with 2 or 4 spaces, minify it to compact output, or run a quick syntax check before copying the result.