Skip to content
OddsockLocal
Local
Source text

The preview shows up here.

ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Paste CSS, minified or already indented.
  2. Read the rules at two-space indent.
  3. Check the last declaration in a block. A semicolon that was absent is still absent.
  4. Use the CSS minifier when you want the bytes back out.

What is CSS formatter?

CSS formatter pretty-prints rules and at-rules so a minified sheet can be read. p{color:red;margin:0}@media (min-width: 40em){p{color:blue}} becomes a p rule with color and margin on their own lines, then the media query, then the inner p. Indent is two spaces.

Read more

It does not repair the stylesheet. The input’s margin:0 had no semicolon after it, and the output still has no semicolon after margin: 0. A formatter that silently inserts punctuation will hide a real syntax problem and sometimes change a value. Comments and strings are left to the beautifier’s usual rules. This page does not remove whitespace to save bytes. That is the minifier, which also drops ordinary comments and keeps the inside of a string such as "a b" intact.

Paste CSS. There is no indent selector and no vendor-prefix option. If the input is not CSS, the result will not magically become valid.

Use cases

  • A style block copied from a bundle is one line and you want each declaration on its own line before a review.
  • A media query is buried at the end of a rule and you want it indented under the query, not flattened.
  • You need to see that a missing semicolon is still missing after formatting, so you can fix it on purpose.
  • The minifier’s one-line output has to be turned back into something a person can edit.

A rule and a media query, semicolon not invented

p{color:red;margin:0}@media (min-width: 40em){p{color:blue}}

p { color: red; margin: 0 } then @media (min-width: 40em) { p { color: blue } }, indented by two spaces. margin: 0 has no trailing semicolon.

Why use Oddsock

Leaving the missing semicolon missing is safer than a formatter that “fixes” CSS and changes what the browser will parse.

Related tools

Using this tool

No. margin:0 in the sample stays margin: 0 without a semicolon. Add the punctuation yourself if the rule needs it.