Skip to content
hateitall

CSS Formatter

Turn a one-line stylesheet into readable, consistently indented CSS without changing what it does.

Processed locallyIn: CSS, TextOut: CSS

Loading tool…

How to use css formatter

  1. Paste CSS, drop a .css file on the box or load the sample.

  2. Choose the indent and whether each selector in a list gets its own line.

  3. Read the formatted CSS on the right; it updates as you type.

  4. Copy it or download it. Download is only offered once the output has passed its check.

What this tool does

  • Handles nested blocks such as @media, @supports and native CSS nesting at any depth.
  • Leaves strings, comments and unquoted url(...) values exactly as written, including semicolons and braces inside them.
  • Puts one declaration per line, adds a space after each colon and comma, and spaces out child and sibling combinators.
  • Reports the line of an unclosed block, a stray } or an unclosed string or comment instead of guessing.

How the result is verified

The formatted output is parsed again and reduced to its minimal form, which must match the minimal form of your input exactly. If it does not, the download stays switched off.

Frequently asked questions

Will formatting change how my page looks?

No. Only whitespace changes. The tool proves it on every run by shrinking both the input and the output to minimal CSS and comparing them byte for byte.

Can it format the CSS inside an HTML file?

Use the HTML formatter for that: it formats the markup and, optionally, the CSS inside each style block with the same engine.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Smaller CSS with comments, whitespace and empty rules removed safely

CSS→ CSSLight on device

Indent HTML neatly while keeping pre, textarea and script content intact

HTML · SVG→ HTMLLight on device

Live CSS editor with HTML to style, presets and phone width preview

CSS · HTML→ PreviewLight on device

Beautify or minify JSON with your choice of indentation

JSON→ JSONLight on device

Compare two texts line by line with changed words highlighted

Text · Code→ DiffModerate on device