CSS Formatter & Minifier

Make unreadable CSS readable, or shrink it for faster loading. Everything runs in your browser; nothing you enter is uploaded or stored.

  • Free, no sign-up
  • Runs in your browser
  • Verified

How to use it

  1. Paste your CSS.
  2. Choose Format or Minify (and indentation or comment handling).
  3. Copy the result.

How it works

The stylesheet is split into rules, declarations and comments while respecting strings, comments and brackets, so a semicolon inside url("a;b.png") or content: "}" never confuses it. Formatting puts each declaration on its own line, each selector of a list on its own line, and indents nested blocks such as @media. Minifying removes comments and unneeded spaces, but keeps the spaces that matter: the one in “a :hover” (a different selector from “a:hover”) and those around + and − inside calc().

The formatter changes whitespace only, which it checks in automated tests: removing all whitespace from the input and output gives the same text (a final missing semicolon may be added).

Examples

  • a{color:red;margin:0} becomes a rule with two declarations on separate lines.

Limitations

  • CSS is not validated: mistakes in your CSS stay mistakes. Check the result in a browser.
  • Minifying does not rewrite values (it will not shorten #ffffff or merge rules), so the saving is smaller than with a full optimiser.
  • Up to 2,000,000 characters.

Last verified . See our Accuracy & Editorial Policy. Found a problem? Email [email protected].