About CSS Formatter
This CSS formatter reads minified or messy stylesheets and rewrites them with one declaration per line, two-space indentation and a space after each colon. Rules inside @media blocks are indented one more level, so responsive styles are easy to follow.
Missing semicolons after the last declaration of a rule are added, comments are kept, and strings are left untouched. Only whitespace changes; selectors, properties and values are not renamed, merged or reordered.
How to use CSS Formatter
- Paste your CSS into the input box.
- Click Run Tool to format it.
- Copy the result or download it as a text file.
Example
Input
.card{color:red;background:#fff;padding:16px}@media (max-width:600px){.card{display:none}} a:hover{color:blue;margin:0 auto}Output
.card {
color: red;
background: #fff;
padding: 16px;
}
@media (max-width: 600px) {
.card {
display: none;
}
}
a:hover {
color: blue;
margin: 0 auto;
}Common uses
- Making a minified third-party stylesheet readable before debugging a layout issue.
- Normalising styles copied from different sources into one consistent format.
- Preparing CSS for a code review or a tutorial.
Privacy and safety
This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.
Frequently asked questions
Does it sort or validate properties?
No. It formats what you give it. Typos in property names or invalid values are not detected.
Does it support nested CSS and media queries?
Yes. Blocks inside blocks, including @media and @supports rules and native CSS nesting, are indented by depth.
Can I get the compressed version again?
Yes. Paste the formatted CSS into the CSS Minifier to remove comments and whitespace.