Beautify CSS
Turn minified or messy CSS into clean code with clear indentation, one declaration per line and readable rules.
Beautify, prettify and minify CSS online. Turn messy or minified code into clean, readable CSS with the indentation you choose, or compress it to reduce file size. Free, fast and private: it runs in your browser.
Your CSS is formatted inside your browser. It is never uploaded or stored on our server.
Paste your code into the input box, or upload a .css file.
Pick the mode and set the indentation and other options.
Copy the clean CSS or download it as a file.
Messy CSS is hard to read, hard to debug and hard to maintain. This free CSS formatter turns minified or badly indented stylesheets into clean, well structured code, and it can also minify CSS to make your files smaller and your website faster. Use it as a CSS beautifier to unminify code from a theme or framework, as a CSS prettifier to apply the same indentation across your project, or as a CSS compressor before you publish. Everything happens on one page, with a simple switch between Beautify and Minify.
You stay in control of the result. Choose 2 spaces, 4 spaces or tabs, put each selector on its own line, add blank lines between rules, sort properties, lowercase hex colors and keep or remove comments. A stats bar shows the size before and after, together with the number of rules and declarations. The formatter runs in your browser, so your code stays private, and there is no signup and no limit on how often you use it.
Turn minified or messy CSS into clean code with clear indentation, one declaration per line and readable rules.
Remove comments and extra whitespace to reduce file size and help your pages load faster.
Format with 2 spaces, 4 spaces or tabs, and choose one selector per line and blank lines between rules.
Group and order properties alphabetically without breaking the cascade of related properties.
Get warnings for missing or extra braces, unclosed comments and strings, with line numbers.
Your CSS never leaves your browser. Nothing is uploaded, saved or shared.
A CSS formatter, also called a CSS beautifier, CSS prettifier or CSS pretty printer, takes CSS code and rewrites it with consistent indentation, line breaks and spacing, without changing what the styles do. Many stylesheets arrive as one long line, because build tools, plugins and CDNs minify them to save bandwidth. Reading or editing that code is almost impossible. Paste it into a CSS formatter and every selector, property and value goes on its own line, so you can understand it, debug it and edit it.
The same tool also works in the other direction. A CSS minifier removes comments and extra whitespace so the file is smaller before you publish it. Having both functions on one page means you can move between a readable development copy and a compact production copy in a few seconds.
Beautifying and minifying are opposite jobs, and a healthy workflow uses both. The table shows what each mode does.
| Feature | Beautify (format) | Minify (compress) |
|---|---|---|
| Goal | Make code readable for people. | Make the file smaller for browsers. |
| Whitespace | Indentation and line breaks are added. | All unnecessary spaces and line breaks are removed. |
| Comments | Kept (you can remove them). | Removed, except important /*! ... */ comments such as licenses. |
| Best for | Development, code review, debugging, learning, editing third-party CSS. | Production websites, faster loading, smaller downloads. |
| Effect on styling | None. | None. |
| Option | What it does |
|---|---|
| Indent (2 spaces, 4 spaces or tab) | Choose the style your team or project uses. |
| One selector per line | Puts every selector of a comma-separated list on its own line, which is easier to read and gives cleaner diffs. |
| Blank line between rules | Adds an empty line between rules and at-rules so blocks stand out. |
| Keep comments | Turn it off to strip comments from the output. |
| Lowercase hex colors | Changes colors such as #FF5733 to #ff5733 for consistency. |
| Sort properties | Orders properties alphabetically by group, for example all border properties together. The order inside a group is kept, because the order of related properties such as a shorthand and a longhand can change the result. |
CSS is render-blocking: the browser must download and process your stylesheets before it can paint the page. A smaller CSS file downloads faster, which helps metrics such as First Contentful Paint and Largest Contentful Paint. These are part of Core Web Vitals and of page speed tests such as PageSpeed Insights and Lighthouse. Removing comments and whitespace usually makes a hand-written stylesheet noticeably smaller.
For the best results, combine minification with Gzip or Brotli compression on your server, remove unused CSS, load only the CSS that a page needs, and serve files through a CDN with caching. Keep the readable version in your source code and publish only the minified file. If minifying is all you need, the dedicated CSS minifier focuses on exactly that.
Sorting declarations alphabetically is popular because it makes long rules predictable. The risk is that the order of some properties matters. A shorthand such as margin followed by a longhand such as margin-top gives a different result when the order is reversed. To stay safe, the formatter sorts by group, for example all border properties together, and keeps the original order inside each group. You get a tidier rule without changing the cascade. If your project uses a custom property order, leave the option off.
| Problem | What you will see | How to fix it |
|---|---|---|
| Missing closing brace } | A warning that one or more blocks are not closed, and the rest of the file is indented too deep. | Find the rule that never ends and add }. |
| Extra closing brace } | A warning with the line number. | Remove the extra brace or check the rule above it. |
| Missing semicolon | Two declarations merged into one odd line. | Add ; at the end of each declaration. |
| Missing colon | A warning that a line is not a valid declaration. | Write it as property: value. |
| Unclosed comment or string | A warning with the line number. | Close the comment with */ or the string with its quote. |
The formatter checks the structure of your code. It does not check whether a property name or a value is valid, so it is not a full linter.
Themes and frameworks usually ship minified stylesheets such as style.min.css or bootstrap.min.css. Paste the content here to beautify it and read the rules before you override them. When you write custom CSS in the WordPress Customizer, in a Shopify theme or in a page builder, format it first so it stays easy to maintain. CSS that comes out of build tools such as Tailwind CLI, PostCSS or Sass can also be formatted to inspect the final output.
The formatter works in any modern browser, so you can format CSS on Android, iPhone, Windows, Mac and Linux without installing an extension or an editor plugin. Open the page, paste your code, pick Beautify or Minify and copy the result. Because everything runs locally, it also works well for quick fixes when you are away from your main computer.
The formatter runs entirely in your browser. Your CSS is not uploaded, stored or sent to any server, so you can safely format private code. The tool formats the structure of the code: it does not check whether property names or values are valid, it is not a full linter, and it does not remove unused CSS. It handles plain CSS, including modern nested rules, media queries, keyframes and font-face. Sass (SCSS) and Less files that use special syntax such as variables with $ or @, mixins, // comments or functions may not format correctly, so compile them to CSS first. Always test the minified file on your site before you publish it.
Our free CSS formatter was built to make it simple to beautify, minify and tidy any stylesheet. If you want a CSS formatter with no signup, no installation and no uploads, this page gives you exactly that. Paste your CSS, choose your options and copy a clean result.
Ready to try it? Scroll back up, paste your CSS and format it in a second.
Short answers about formatting, beautifying and minifying CSS.
Yes. It is free, needs no signup and runs entirely in your browser. Your CSS is not uploaded or stored, so private code stays on your device.
Beautify adds indentation and line breaks so people can read the code. Minify removes comments and unnecessary whitespace so the file is smaller. Both keep the styles working the same way.
No. The tool only changes whitespace, comments and the letter case of property names and hex colors. If you turn on Sort properties, groups are sorted but the order inside a group is kept so the cascade stays the same. Always test the minified file on your site before you publish it.
It is made for plain CSS, including nested rules. SCSS and Less features such as $variables, mixins and // comments may not format correctly, so compile them to CSS first.
It depends on how many comments and how much whitespace the file has. Hand-written CSS often becomes noticeably smaller, and the stats bar shows the exact saving. Gzip or Brotli on your server reduces the size even more.
Paste the minified code, choose Beautify and copy the result. Each rule and declaration is placed on its own line with clean indentation.
It does not check whether property names or values are valid. It warns about structure problems such as missing or extra braces, unclosed comments and strings, and lines without a colon, so you can fix them in your code.
Format, beautify and minify CSS, try the CSS beautifier for readable code, shrink files with the CSS minifier or format JSON in the same place. Explore free developer tools to format, convert and debug your code in one place.
Explore All Developer Tools →