CSS Formatter

Beautify messy or minified CSS into clean, indented rules — or minify it for production — right in your browser.

Suggested tools

CSS Minify

Shrink CSS by removing comments and spaces, keeping it valid.

CSS
Open Tool

HTML Formatter

Indent and tidy HTML, or minify it.

HTML
Open Tool

JavaScript Beautifier

Make minified JavaScript readable with clean indentation.

JavaScript
Open Tool

Color Converter

Convert colours between HEX, RGB and HSL with a preview.

HEXRGBHSL
Open Tool

HTML Minify

Remove comments and extra whitespace from HTML safely.

HTML
Open Tool

JSON Formatter

Beautify, minify and validate JSON instantly in your browser.

JSON
Open Tool

About CSS Formatter

CSS Formatter turns minified or messy stylesheets into clean CSS with one rule per block, one declaration per line and consistent two-space indentation. It is the fastest way to read a minified file from a website, review a teammate's styles or tidy CSS copied from a design tool.

The same page can also minify CSS when you are ready to ship it. Everything runs locally in your browser — the text you paste is never uploaded.

How to use CSS Formatter

  1. Paste your CSS, upload a .css file or click Sample.
  2. Press Beautify to format it, or Minify to compress it.
  3. Copy the result or download it as a file.

Key features

  • Beautify and Minify on one page
  • Handles media queries, nested at-rules and comments
  • Formatting powered by the widely used js-beautify library
  • Works offline once the page has loaded

Example

Input
.btn{color:#fff;background:#2563eb}.btn:hover{background:#1d4ed8}
Output
.btn {
  color: #fff;
  background: #2563eb
}

.btn:hover {
  background: #1d4ed8
}

When to use CSS Formatter

  • Reading the minified stylesheet of a website you are debugging.
  • Tidying CSS copied from a design tool or a code snippet.
  • Making a stylesheet consistent before a code review.

Tips and common problems

  • Keep your formatted source file and only ship the minified version.
  • If the result looks wrong, look for a missing } — formatting follows the braces you wrote.
  • For SCSS-heavy files, a project formatter such as Prettier handles every feature.

Frequently asked questions

No. Only whitespace and line breaks change; selectors, properties and values stay exactly the same.