Shard Tools

CSS Formatter

Format your CSS instantly, in your browser.

Maintained by Roshan.

Use CSS Formatter

Converts css to formatted css in this tab, with nothing sent anywhere.

Runs entirely on your deviceThe conversion happens in this browser tab. Nothing you type is uploaded, logged or stored, which is worth knowing for anything you would not paste into a search box.

Explore developer and data tools

Find related browser-local tools for nearby tasks without starting another search.

Browse all developer and data tools

About CSS Formatter

A CSS formatter expands minified or messy stylesheet text into a clean, indented layout - one declaration per line, each rule spaced out - so it can be read and edited. Production CSS ships minified to save bytes, and CSS copied from a built site or a dev-tools panel often arrives as one dense run that is impossible to work with. This tool beautifies your CSS in the browser, restoring the structure that makes a rule's selectors and declarations clear. It runs locally, so proprietary stylesheet code is expanded without being sent to any server. The most common reason people reach for it is inspection: you find a rule in a live site's minified bundle, paste it here, and suddenly its selectors and every declaration are laid out where you can reason about specificity and overrides. It is equally useful for learning, since a formatted stylesheet makes the relationship between a selector and its block obvious in a way a single dense line never can. Once you have made your edits, the CSS minifier linked below collapses it straight back to production form.

Using CSS Formatter

  1. Paste your CSS, minified or messy. It is reformatted in this browser tab.
  2. Each rule is placed on its own lines, declarations are indented one per line, and selectors separated by commas are broken out.
  3. Copy the formatted stylesheet, now readable and ready to edit.

Where css formatter helps

Reading production CSS

A minified stylesheet copied from a live site is expanded so a specific rule can be found and understood.

Editing pasted styles

CSS pasted as one line from dev tools is formatted into an editable block.

Before you use the result

Questions about CSS Formatter

Does formatting change styles?

No. Only whitespace changes, so the formatted stylesheet renders exactly like the original.

Will it fix invalid CSS?

No - it lays out what you give it. Genuinely broken syntax is formatted as-is, not corrected.

Related tools

CSS Minifier

CSS Minifier in your browser. Instant, accurate, and nothing is uploaded.

SQL Formatter

SQL Formatter in your browser. Instant, accurate, and nothing is uploaded.

HTML Entity Encoder

Encode text as HTML entities in your browser so it displays as text instead of being interpreted as markup.