Free online text tool

CSS Beautifier

CSS Beautifier turns minified or messy CSS into clean, indented code with one rule and one declaration per line. Paste your CSS, choose the indent, click the button and copy the result. It is free and runs in your browser.

CSS Beautifier Tool

0Character Count
0Character Count (without spaces)
0Word Count
0Sentence Count
0Paragraph Count
0Line Count

CSS Beautifier Example

Before
.container{width:100%;max-width:1200px;margin:0 auto}h1{font-size:2rem;color:#333}button:hover{background:#c8f135}
After
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  font-size: 2rem;
  color: #333;
}

button:hover {
  background: #c8f135;
}

Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.

Suggest a New ToolProvide Feedback on This Tool

What is a CSS beautifier?

A CSS beautifier, also called a CSS formatter, adds line breaks, indentation and consistent spacing to CSS. Minified code, which is written on one line to save space, becomes easy to read and edit.

The tool changes only whitespace: each selector gets its own line, each declaration goes on its own line, and a space is added after colons and commas. The values, selectors, comments and strings stay as you wrote them.

It is made for plain CSS and does not check your code for errors. Use it before you edit a minified file, review a stylesheet or compare two versions.

CSS beautifier examples

Each rule and declaration goes on its own line. These examples use a 2 space indent.

BeforeAfter
a{color:red}
a {
  color: red;
}
h1,h2{margin:0}
h1,
h2 {
  margin: 0;
}
@media (max-width:600px){.nav{display:none}}
@media (max-width: 600px) {
  .nav {
    display: none;
  }
}
a{color:red!important}
a {
  color: red !important;
}

How to beautify CSS

  1. 1
    Paste your CSS
    Paste minified or messy CSS into the box, or import a text file.
  2. 2
    Choose the indent
    Pick 2 spaces, 4 spaces or a tab.
  3. 3
    Click Beautify CSS
    The code in the box is formatted at once. Use Undo if you change your mind.
  4. 4
    Copy it
    Click Copy and paste the formatted CSS into your editor.

When to use a CSS beautifier

Good for

Reading minified CSS, cleaning up a stylesheet before you edit it, making code reviews easier and keeping the same style across a project.

Check first

The tool does not validate CSS or support SCSS and Less syntax such as // comments. Keep a copy of your original code, or use Undo right after formatting.

Other tools

To make CSS smaller before you publish it, use a CSS minifier. To format other code, try the HTML, JavaScript, JSON or XML beautifiers.

CSS beautifier FAQ

What is a CSS beautifier?

A CSS beautifier takes minified or messy CSS and adds line breaks, indentation and consistent spacing, so each rule and declaration is easy to read and edit. It is also called a CSS formatter.

How do I beautify CSS?

Paste your CSS into the box, choose the indent size and click Beautify CSS. The formatted code replaces the text in the box. Click Copy to use it, or Undo to go back.

Does it change what my CSS does?

No. The tool only changes whitespace, such as line breaks, indentation and the space after a colon or comma. It also adds a missing semicolon after the last declaration in a rule. Values, selectors, comments and strings are kept as they are.

What is the difference between beautifying and minifying CSS?

Beautifying adds spaces and line breaks to make CSS readable. Minifying removes them to make the file smaller. Use a beautifier when you want to read or edit code, and a minifier before you publish it.

Which indent size can I choose?

You can choose 2 spaces, 4 spaces or a tab. Two spaces is a common choice for CSS, but use whatever your project or style guide requires.

Does it handle media queries, comments and data URIs?

Yes. Rules inside @media and @supports blocks are indented, comments are kept, and values such as url(data:image/png;base64,...) and quoted strings are not broken, even when they contain semicolons or braces.

Does it work with SCSS, Sass or Less?

It is made for plain CSS. Simple nested rules may be indented correctly, but preprocessor syntax such as // comments, mixins and maps is not supported and may be formatted wrongly.

Does it check my CSS for errors?

No. It is a formatter, not a validator. If your CSS has a missing brace or a typo, the tool formats what it can, but it does not report errors. Use a CSS validator or your editor to find them.

Is this tool free and is my code private?

Yes. It is free, needs no account and runs in your browser, so your CSS is not uploaded to a server.

Looking for more text tools?

Browse Formatter Tools

Last updated: 26 October 2026