Beautify CSS with clean indentation, or minify it to shrink file size. Handles media queries, calc() and license comments.
How to use the CSS Formatter
Paste your CSS into the input box.
Choose Beautify to format it or Minify to compress it.
Pick the indent size, then copy the result.
This is a CSS formatter that beautifies stylesheets with clean, consistent indentation, or minifies them to shrink file size. You choose the indent size for beautifying, and switch to minify when you want the smallest output.
Readable CSS is easier to scan, review and debug: when each rule and declaration is indented consistently, you can see selectors, nesting and the shape of your media queries at a glance.
Minifying is for production. It removes the whitespace and comments that browsers do not need, so the file downloads faster. On a large stylesheet the saving adds up, especially before gzip compression on the server.
The minifier is careful where it matters. It keeps the spaces around plus and minus inside calc(), so calc(100% - 30px) stays valid, and it only strips spaces around structural characters such as braces, colons and semicolons. It also handles nested media queries correctly.
License comments written in the /*! ... */ form are preserved, which is the standard convention for keeping copyright and license notices in minified output even when ordinary comments are removed.
Both beautify and minify run entirely in your browser, so your stylesheets never leave your device. The tool formats for readability and size; it does not validate that your CSS is correct.
Frequently asked questions
No. The minifier keeps the spaces around plus and minus inside values, so calc(100% - 30px) stays valid. It only removes spaces around structural characters such as braces, colons and semicolons.
Normal comments are removed to save space, but license comments written as /*! ... */ are kept, which is the standard convention for preserving copyright notices.
No. Both beautify and minify run entirely in your browser, so your stylesheets never leave your device.
Beautify while you are reading, editing or reviewing CSS. Minify the final stylesheet for production, where a smaller file loads faster for visitors.
No. It formats and minifies the text for readability and size but does not validate properties or values, so it will reformat CSS even if it contains a mistake.
Embed this tool
Add this tool to your own website. Copy the snippet below; it stays up to date automatically.
<iframe src="https://monu.tools/embed/en/css-formatter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>Related tools
Beautify HTML with block-aware indentation, or minify it. The contents of pre, textarea, script and style are preserved.
Beautify and prettify JavaScript with consistent indentation and spacing. Runs entirely in your browser.
Convert CSV to an Excel .xlsx file and Excel back to CSV, entirely in your browser. Works in both directions.
Generate TypeScript interfaces from a JSON sample, with nested types, arrays and optional fields. Runs in your browser.