Formatters / LOCAL TOOL

CSS Formatter & Validator

Format and validate modern CSS locally while preserving strings, comments, URLs, and calc expressions.

Runs locally — input is never uploaded
Paste or type CSS

WHAT IT DOES

Format CSS without breaking the values inside it.

Format modern CSS with a real bundled parser, then optionally produce a compact version. Comments, strings, data URLs, custom properties, nesting, layers, media queries, and calc expressions are parsed as CSS rather than rearranged by a whitespace-only regular expression.

Why use it?

Use it to make a stylesheet readable or compact without confusing whitespace removal with redesigning or validating its appearance.

How to use this tool

  1. Paste CSS, choose indentation, and format it.
  2. Use Minify if you need compact source, then check the result in your target browsers.
  3. For example, inspect a calc() declaration after rewriting. The tool does not fetch imported stylesheets, test selectors against your page, or produce a browser-compatibility report.

Details and limitations

  • Prettier's CSS parser is bundled locally and reports syntax errors before output is written.
  • Formatting keeps comments, quoted strings, URLs, custom property values, and modern at-rules in the CSS grammar.
  • Minify removes formatting-only whitespace and ordinary comments with a stateful scanner after parsing; it does not rewrite declarations or values.
  • Indentation can be selected as two spaces, four spaces, or tabs.

COMMON QUESTIONS

CSS Formatter questions

Does formatting support modern CSS syntax?
It uses Prettier's bundled CSS parser, which covers current CSS constructs such as nesting, layers, custom properties, functions, and media queries where the parser supports them.
Is CSS minification safe for calc and data URLs?
The minifier tracks comments, quotes, escapes, and parentheses so it only removes formatting whitespace outside protected values. It does not attempt semantic declaration rewrites.
Does this check browser compatibility?
No. It checks CSS syntax and formats it. Browser support and project-specific lint rules need a compatibility or linting tool.