Category: Developer tools

CSS Formatter

System ideaMissing a tool?

Format readable CSS or switch to minify mode in your browser

Paste CSS, choose 2 or 4 spaces, format selectors, declarations, comments and nested at-rules, or minify and compare UTF-8 byte sizes.

Formatted in your browser.

Original size140 BResult size159 B
Result
.tool-panel {
  display:grid;
  gap:16px;
  padding:16px
}
/* accent border */
.tool-panel .tool-output {
  border:1px solid var(--line);
  border-radius:8px
}

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This CSS formatter makes pasted stylesheets readable and also includes a minify mode. It tokenizes comments, quoted strings and plain text before laying anything out, so braces, colons or semicolons inside strings and comments are not treated as syntax. In format mode, each declaration goes on its own line, the opening brace stays on the selector line, and the closing brace gets its own line. Indentation can be 2 or 4 spaces. Nested blocks such as @media, @supports and @keyframes indent one level deeper per open brace, and /* */ comments are placed on their own line at the current indent. Repeated whitespace inside selectors and values collapses to single spaces. Minify mode drops comments, collapses whitespace, removes spaces around braces, colons, semicolons and commas, and removes the final semicolon before a closing brace. The page shows input and output sizes as UTF-8 bytes and provides sample, clear and copy actions. It does not validate CSS, report syntax errors, warn about unknown properties, add vendor prefixes, target browsers, sort selectors or properties, merge shorthand, remove duplicate rules, detect dead selectors, preprocess Sass, Less or Stylus, expand nesting, optimize colors or units, handle source maps, upload files, download .css files, wrap to a line width or show a saved-percentage figure. CSS stays in the browser.

How to use it

  1. Paste CSS into the editor or load the sample stylesheet.
  2. Choose format or minify mode, and set indentation to 2 or 4 spaces for formatting.
  3. Compare input and output byte sizes, then copy the CSS result.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

Will formatting CSS change how it works?
Format mode changes whitespace, line breaks and indentation. It keeps selectors, properties and values, but it does not validate or repair invalid CSS.
Is CSS uploaded to a server?
No. Formatting, minifying and copying run in the browser, and the stylesheet is not uploaded to LocalTools.
Can it minify CSS too?
Yes. Minify mode removes comments and extra whitespace around CSS punctuation, but it does not perform deeper color, unit or rule-level optimizations.
Does it support @media and @keyframes?
Yes. Nested blocks such as @media, @supports and @keyframes are indented one level deeper for each open brace.
Does it validate CSS or add prefixes?
No. There is no validation, syntax-error reporting, unknown-property warning, autoprefixer behavior or browser-support targeting.