InTab

CSS Formatter

Beautify CSS with one rule per block and consistent indentation.

Formatters: Pretty-print, minify, validate and compare. It runs in your browser, so nothing you enter is uploaded.

What it does

The CSS Formatter puts each rule and declaration on its own line with consistent indentation and a blank line between rules. It makes minified or hand-written stylesheets easy to read, review and compare.

How to use it

  1. Paste CSS into Input, or click Sample.
  2. Click Beautify.
  3. Choose the indent, and tick Keep blank lines to keep the blank lines you already had.
  4. Copy or download the result.

Example

.btn{margin:0}.btn,.link{color:#fff}

Beautified:

.btn {
  margin: 0
}

.btn,
.link {
  color: #fff
}

Good to know

  • Media queries, @supports, keyframes and custom properties are formatted too.
  • SCSS and Less usually format correctly, because their syntax is close to CSS.
  • To compare two versions of a stylesheet, format both first and then use the Diff Finder.

FAQ

Does it change my styles? No. Only whitespace and line breaks change; selectors, values and order stay the same.

How do I make CSS smaller instead? Use the CSS Minifier.

More Formatters tools

  • JSON Formatter: Beautify, minify, validate and sort JSON. Handles escaped/stringified JSON.
  • XML Formatter: Beautify, minify and validate XML documents.
  • SQL Formatter: Format SQL for MySQL, PostgreSQL, T-SQL, SQLite and more.
  • Diff Finder: Compare two texts or JSON documents line by line or word by word.
  • Text Diff Checker: Paste two versions of a text and see exactly which words changed.
  • JSON Validator: Check JSON is valid and see the exact line, column and a fix hint when it is not.
  • JavaScript Formatter: Beautify minified or messy JavaScript with your choice of indentation.
  • JavaScript Minifier: Minify JavaScript with Terser: compress, shorten names and see the size saved.
  • HTML Formatter: Indent and tidy HTML, or minify it for production.
  • CSS Minifier: Minify CSS with CSSO: remove whitespace, merge rules and shorten values.
  • YAML Formatter: Validate and re-indent YAML, keeping comments, with optional key sorting.