CSS Formatter Minifier screenshot

CSS Formatter Minifier

Beautify or minify CSS code.

Privacy First
0 Runs
Updated 2026-11-06
Runs in your browser
Nothing uploaded
No account needed

Beautify or minify CSS code. Enter your numbers and get an instant result.

Paste a stylesheet and this page either indents it rule by rule or compresses it onto as few characters as it can. Two spaces, four spaces and minified output are all produced from the same text in the tab.

It is a text formatter, not a CSS parser. At-rules, nested blocks and custom properties pass through as text, comments are removed in both modes, and nothing is checked for validity.

Because comment removal is unconditional, a stylesheet that carries a licence header will lose it. Keep a copy if that matters, and note that nothing is uploaded at any point.

How the two modes rewrite the text

Beautify removes comments, collapses runs of whitespace, then puts a newline after each opening brace, each closing brace and each semicolon, indenting by the current brace depth.

Minify removes comments, collapses whitespace, removes the spaces around braces, semicolons, colons and commas, and drops the last semicolon before a closing brace.

  • Comments are removed in both modes
  • Beautify indents by brace depth, so @media blocks nest correctly
  • Minify keeps selectors, values and units byte for byte

What formatting cannot check

A tidy stylesheet can still be invalid. An unclosed brace, an unknown property or a selector the browser does not understand all survive the rewrite, because the page never builds a rule list.

The indent is driven by counting braces in the text, so a brace inside a string or a data URI will shift the indentation of the lines that follow. When that happens, format the block without that value or fix the indent by hand.

How to use the format buttons

Paste the stylesheet into the Raw CSS pane and press Format (2 Space), Format (4 Space) or Minify CSS; the Output pane shows the rewritten text. Beautify puts a newline after each brace and semicolon at the current brace depth; minify removes comments, collapses whitespace, and drops the last semicolon before a closing brace.

Comments are removed in both modes, so keep a copy when the sheet carries a licence header. The page never builds a rule list: an unclosed brace or a brace inside a string shifts the indent of the lines that follow, and nothing is checked for validity.

What to Expect

Best for

  • Making a pasted stylesheet readable
  • Compressing a short stylesheet for inline use
  • Comparing two rules once their indentation matches

Not ideal for

  • Checking CSS for validity or browser support
  • Autoprefixing or transforming modern syntax
  • Stylesheets whose comments must be preserved

What this tool keeps

  • Selectors, properties and values as written
  • The order of the rules
  • Whitespace inside quoted strings

What may need cleanup

  • Comments, including licence headers, which are removed
  • Indentation after a brace inside a string or data URI
  • Long single-line rules, which are not wrapped at a width

Common errors

  • Expecting the output to be validated
  • Being surprised that a licence comment disappeared
  • Formatting a preprocessor dialect that is not plain CSS

Example use cases

  • Re-indenting a rule block before pasting it into a file
  • Compressing a few rules for an inline style attribute
  • Reading a minified vendor stylesheet

Sample input

Paste body{background-color:#ffffff;color:#333333;margin:0;}h1{font-size:2rem;} and choose two spaces.

Sample output

Two rules, each selector on its own line, one declaration per line and two spaces of indent.

Who this is for

  • Front-end developers tidying a stylesheet
  • Anyone reading a minified theme file
  • Designers preparing a snippet for handoff

Frequently asked questions

What do the two CSS modes do?

Beautify indents the stylesheet rule by rule and minify compresses it onto as few characters as it can; two-space and four-space indentation are both available.

Does the formatter check browser support or add vendor prefixes?

No. It only rewrites whitespace, so validity, prefixes and modern syntax are left exactly as written.

Why did my comments disappear?

Comments, including licence headers, are removed by the rewrite. Keep a copy of any comment you must preserve.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.