CSS Formatter
A CSS formatter, or beautifier, reorganises stylesheet code so each selector, declaration and closing brace sits on its own indented line. This free tool formats CSS as you type with 2-space, 4-space or tab indentation, or minifies it for production, keeps comments, strings and url() values intact, and warns about unclosed braces or declarations missing a colon.
Free, no signup. Runs entirely in your browser; files and text are not uploaded.
How to use the CSS Formatter
- Paste CSS into the CSS input box, open a .css file, or click Load sample.
- Choose Beautify or Minify.
- Select an indent of 2 spaces, 4 spaces or Tab.
- Review any syntax warnings shown below the editors.
- Copy or download the result.
Features
- Beautifies CSS with one declaration per line
- Minifies CSS and shows the size saving
- Handles nested rules and @media / @supports blocks
- Keeps pseudo-classes, strings and url() data URIs intact
- Warns about unbalanced braces, unclosed comments and missing colons
- Keeps comments when beautifying and /*! licence */ comments when minifying
- Open .css files, copy and download
Frequently asked questions
Will formatting change how my CSS works?
No. Only whitespace and line breaks change; selectors, property values and strings are kept as written. Minifying also drops comments and the last semicolon in each block, which browsers do not need.
How much does minifying CSS save?
It depends on how much whitespace and how many comments the file has, and the tool shows the exact percentage saved for your code. Serving files with gzip or Brotli compression saves more on top.
Does it support nested CSS and media queries?
Yes. @media, @supports and native CSS nesting are indented by level. SCSS that follows the same brace structure is formatted too, but mixins and variables are not compiled.
Is my CSS uploaded?
No. The formatter runs in your browser and your code never leaves your device.
Related tools
- HTML Formatter – Indent or minify HTML, keep pre/script content safe and flag unclosed tags
- Color Picker – Pick colours and get HEX, RGB, HSL and CMYK codes, tints, harmonies, contrast and image colours
- JSON Formatter – Beautify, minify and validate JSON with error line numbers, key sorting and auto-fix
- SQL Formatter – Beautify or minify SQL for MySQL, PostgreSQL, SQL Server, Oracle, BigQuery and more
Built and reviewed by Naqash Thaheem, Technical Project Manager. Last reviewed 2026-09-24.