Help
  • Click the "Example" button to see a CSS formatting demo

CSS Formatter

This free online CSS formatter cleans up and reorganizes your stylesheets — and can minify them back down for production.

All tools on this site run entirely in your browser locally. No data is uploaded to any server.

Features:

  • Beautify: Re-indent CSS into a clear selector hierarchy, with 2, 3 or 4 spaces per level (2 by default)
  • Minify: Strip whitespace and line breaks, compressing everything into a single line
  • Code folding: Collapse and expand rule blocks to navigate large stylesheets
  • Local files: Open a CSS file from your computer, or drag and drop it into the editor

FAQ:

  • Q: Do I need to click Format, and why does it read the right pane?
    A: No: typing in the left pane reformats into the right pane automatically. Format reads the right pane instead, so you can tidy stylesheets you've edited there or expand a minified one-liner back into readable rules. Copy, Minify and Save use the right-hand text too. Typing in the left pane again regenerates the right pane, so manual edits there are overwritten.
  • Q: Can I change the indentation?
    A: Yes. The toolbar offers 2, 3 or 4 spaces (2 by default), reformats as soon as you switch, and remembers your choice. The only option under Settings is Line Wrap, which controls how long lines are displayed in the right pane, not the output.
  • Q: Does Minify just strip whitespace?
    A: No. Minify runs CSSO on the right-hand text. It also removes comments, shortens colors and zero values, and merges selectors and declarations where possible — #ff0000 becomes red and 0px becomes 0. Comments starting with /*! are kept. Format re-indents the result, but removed comments and rewritten values don't come back.
  • Q: What do the fold button and the 3/12 counter do?
    A: The button collapses or expands every rule block at once; the arrows beside the line numbers fold individual blocks. The counter shows the cursor line and the total line count, so 3/12 means line 3 of 12. It disappears when the right pane is empty.
  • Q: Why does clicking Sample twice clear the editor?
    A: Sample is a toggle: the first click loads a sample stylesheet, and a second click clears both panes if you haven't changed it. Edit the sample and clicking Sample again restores the original instead.

Common uses:

  • Cleaning up minified or compressed CSS for easier reading and debugging
  • Compressing CSS to reduce page load size
  • Spotting malformed selectors and other structural issues
  • Tidying up CSS snippets copied from browser DevTools or templates