Skip to content
toolsdocks

CSS Formatter and Beautifier

Paste minified or untidy CSS and get a readable stylesheet. This page opens the code formatter with CSS and Format chosen; Prettier formats it in your browser.

Runs on your device

More options in the full Code formatter and minifier.

Loading tool…

How to use it

  1. Paste your CSS, or open a .css file.
  2. Leave Language on CSS and the action on Format (preselected here).
  3. Choose the indent and line width.
  4. Copy the result or download formatted.css.

Worked example

.card{display:flex;gap:12px}.card h2{margin:0} becomes two rules on separate lines: .card { with display: flex; and gap: 12px; indented by two spaces, then .card h2 { with margin: 0;.

Formats and limits

InputCSS
OutputFormatted CSS
EnginePrettier standalone; Terser; CSSO; HTML whitespace/comment minifier with embedded CSS/JS minification

Limitations

  • Formatting does not change values or merge rules; use Minify CSS for that.
  • An unclosed brace or a similar error stops formatting until it is fixed.
  • There is no SCSS or Less setting; the input is read as plain CSS.

Questions

Can it unminify a .min.css file?

Yes. Prettier puts each rule and declaration on its own line with your indent, so a one-line stylesheet becomes readable again. Removed comments cannot be restored.

Which options are there?

Indent of 2 spaces, 4 spaces or tabs, and a line width of 80, 100 or 120 characters.

Why does it report a syntax error?

Prettier needs CSS it can parse, such as matching braces. The error shows its line and column and no output is produced until it is fixed.

Is my CSS uploaded?

No. The code is processed in your browser and nothing is uploaded.

Privacy

Runs on your device. Files and text are processed in this browser tab and are not uploaded.

This page opens the Code formatter and minifier ready for this task. See the privacy policy for how toolsdocks handles data.