consolelog.tools

CSS Formatter

Beautify minified or hand-written CSS with Prettier — live, with precise code-frame errors and before/after stats.

About this ToolHow it works, benefits & use cases

Take minified, inconsistent, or hand-written CSS and turn it into clean, properly indented stylesheet code. This CSS formatter runs Prettier with its postcss parser entirely in your browser, so selectors, declarations, and at-rules are laid out consistently every time. You control the print width and tab width, switch between tabs and spaces, and choose single or double quotes for string values. Because it parses the CSS rather than reformatting with regex, a malformed rule is reported with a precise line and column and a code-frame snippet with a caret pointing at the problem instead of producing broken output. The result regenerates live as you type, a before/after line and byte count appears below, and an "already formatted" confirmation shows when no changes were needed. No upload, no sign-up — your styles stay on your machine.

How to Use

  1. 1Set your preferences in the Options panel: print width, tab width, tabs or spaces, and single or double quotes.
  2. 2Paste your CSS into the input box, or click Load example to load a minified sample.
  3. 3The formatted CSS regenerates live as you type or change options.
  4. 4Press Format CSS to confirm the result; any syntax error is shown with its line, column, and a caret code-frame.
  5. 5Copy the formatted CSS, download it as formatted.css, or share the URL with your input and options encoded in it.

Key Benefits

  • Powered by Prettier’s postcss parser for accurate, consistent CSS formatting
  • Control over print width, tab width, tabs vs. spaces, and quote style
  • Parser-based, so malformed CSS is flagged with line, column, and a caret snippet
  • Before/after line and byte stats, plus an "already formatted" confirmation
  • Live reformatting as you edit or adjust options
  • Shareable URL captures your CSS and formatting options for handoff
  • Runs entirely in-browser — your stylesheets are never uploaded

Common Use Cases

  • Expanding minified production CSS into readable, indented source for debugging
  • Standardising the formatting of a stylesheet before committing it
  • Cleaning up CSS pasted from a build output, dev tools, or another project
  • Reformatting hand-written CSS to a consistent print width across a codebase
  • Inspecting how Prettier would reformat a tricky selector or at-rule

Options

0 characters · live

Paste CSS above to format it live.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools