CSS Beautifier
Beautify or minify CSS in your browser. Open a local .css file or paste, get clean readable code or squash it to one line. Comments and data-URIs stay intact, nothing is uploaded.
- Free, no account
- No watermark
- No usage limit
About the CSS Beautifier
Most CSS beautifiers make you paste. This one lets you open the actual .css file off your disk, drag it onto the box, or paste a file you copied from your file manager, then it lays the stylesheet out so a human can read it. And when you are done reading or editing, flip one toggle to Minify and it packs the whole thing back down to a single line, ready to ship. It runs both directions on one page, and none of it ever leaves your browser. Paste a client's private production stylesheet without a second thought, nothing is uploaded and nothing is logged.
That round trip is the whole point. You pull a squished .min.css from a live site or a vendor bundle, beautify it to find the rule you need, make your edit, then minify it again for the download. That handles the file's whole life in one tab.
Beautifying never changes what your CSS does. It will not reorder a declaration, merge two rules, drop a duplicate, or rewrite a color. Selectors, properties, and values come out identical to what you gave it, only the whitespace and line breaks move. So the page renders exactly the same before and after, you just get code you can actually work with.
How to use
- Load your CSS. Paste it into the top box, click Open file to pick a
.cssoff your machine, or drag the file straight onto the box. You can also paste a file you copied in your file manager. - Pick a direction. Beautify spreads the CSS out for reading. Minify collapses it back to one compact line. The output updates live, there is no process button to press.
- Set the indentation (Beautify mode). Toggle between 2 spaces, 4 spaces, or tabs, and flip the blank-line option if you want a gap between top-level rules. The output re-flows the instant you change it, so you can match whatever your project already uses.
- Read the result in the lower box. In Minify mode it also shows how many bytes you shaved off.
- Copy or download. Grab it with the copy button, or hit Download .css to save
formatted.cssorminified.cssstraight to your downloads. - Share your setup. The Share button copies a link with your current direction and settings baked in, so a teammate opens the tool exactly the way you left it. Embed drops the live tool onto your own site, and Bookmark keeps it a keystroke away.
Hit Load sample to watch it run on a realistic mess. The sample packs a minified button, a comment, a data-URI background, and a @media block, so you can see what gets touched and what stays put.
What beautifying actually does
A beautifier is not doing anything clever, it applies a handful of plain layout rules to code that had them applied inconsistently or not at all. Each selector gets its own line, each declaration gets its own indented line, spacing settles to one space after the colon, and a rule inside an @media query is pushed one level further in. The one that changes how you work is the declaration per line, because that is what makes a git diff on beautified CSS legible instead of a single unreadable changed line. It adds nothing and removes nothing from the meaning of your styles, which is why it is safe to run on production CSS you are about to debug.
The round trip, and why the file never leaves your machine
Most free formatters online do one job and make you paste text into them, which falls apart the moment your CSS lives in a file. You want to read a vendor theme.min.css or your own build output, so you open it in an editor, select all, copy, switch tabs, paste. You can skip all of that by pointing Open file at the file, or dragging it onto the box, and it loads. Read or edit, then switch to Minify, and Download .css writes the shipped version straight back out.
The privacy here is the main reason to trust this with real work. A lot of online CSS tools quietly send your stylesheet to their own server to do the formatting. Nobody worries about that with a throwaway snippet grabbed off a blog. It becomes a real problem when the file is a client's proprietary design system or an unreleased product's CSS, and you have just handed it to a stranger's server. Everything on this page runs as JavaScript inside the tab you are looking at, so your stylesheet stays on your device, full stop. Once the page has loaded it even keeps working with your wifi off.
Comments, media queries, and the parts naive tools break
A cheap beautifier gets the common cases right but corrupts the harder ones, like data-URIs and content strings. The interesting cases are the ones a find-and-replace approach gets wrong, so this one reads your CSS character by character and tracks where it is.
Comments survive when you beautify. Every /* ... */ block keeps its place relative to the code around it, so that note explaining why a z-index is 9999 is still right where you left it. Minify is the opposite job, it drops comments to shed bytes, though it keeps a /*! ... */ banner because that bang marker is the convention for a license header you want to survive minification. And @media and other at-rule blocks nest properly, so a media query's inner rules get indented one extra level, and @supports, @keyframes, and native CSS nesting all follow the same logic.
Strings and url() are protected, and this is where naive tools corrupt your CSS. A content: "a. B { c }" string is full of characters that look like structure, and a data-URI in background: url(data:image/svg+xml,<svg>...</svg>) is packed with colons, slashes, commas, even braces inside the SVG. A formatter that just chops on every brace and colon it sees would shred both. This one knows when it is inside a string or a url() at every character, so your data-URIs come out byte for byte identical in both directions.
Two spaces, four, or tabs
On depth, 2 is compact and dominant in modern web tooling (Prettier ships with it) since CSS nests shallowly, and 4 is more emphatic and common in older codebases, and there is no wrong answer between them. The only thing that genuinely matters is picking one and staying consistent, because what actually hurts a file is mixed indentation rather than the width you settled on. Tabs help by letting each developer set their own display width in the editor, a real accessibility win, while spaces render the same in every diff viewer, so match whatever your team already does and spend the argument elsewhere.
Two honest notes. If a stylesheet was already minified with its comments stripped, beautifying cannot bring them back, they were deleted and no amount of formatting invents them. And if the CSS lives in a repo you own and ships on every deploy, wiring up Prettier or your editor's format-on-save is the better long-term move. This tool is for the one-off, the file you need readable in the next ten minutes without configuring anything.
Frequently asked questions
Does opening or dropping a file upload it anywhere?
No. When you open or drag a .css file, your browser reads it into the page directly, and it is never sent to a server or logged. The same goes for anything you paste and for the result. It all stays on your device, and the tool keeps working with no connection once the page has loaded. That is what makes it safe for a client's proprietary stylesheet or an unreleased product's CSS.
Can I open a .min.css straight from my downloads, and what files does it accept?
Yes, that is the common case. Point Open file at a .min.css or drag it in and it loads instantly. The picker is set for .css, but the box will read any plain-text file, so a .scss or .less opens too. It lays out the structure fine, it just will not understand Sass-only syntax like mixins the way a real Sass compiler would.
Is the Minify direction the same as your CSS Minifier tool?
The core is the same safe engine, so both shrink your CSS without corrupting a data-URI. The difference is focus. This page is built around the beautify-then-minify round trip on a file, while the dedicated CSS Minifier is the one to bookmark when shipping bytes is the entire job. Use whichever matches what you actually came to do.
Will beautifying or minifying change how my CSS renders?
No, both are layout-only. Neither direction reorders declarations, merges rules, drops a duplicate, or rewrites any value, they only move whitespace and line breaks around. So the browser paints the page identically before and after, and there is no behavioral risk to running either on production CSS.
Does it keep my comments?
When you beautify, yes. Every /* ... */ comment is preserved in place, since readability is the whole goal. When you minify, comments are dropped to save bytes, which is standard, with one exception. A /*! ... */ banner is kept, because that bang marker is the convention for a license header you want to survive minification. So beautify to read your comments, and if you need a banner to stick around when you minify, write it with the bang.
Does the Share link remember my settings?
It does. The Share button copies the page URL with your current direction, indent size, and blank-line choice encoded into it. Send that link and whoever opens it lands on the tool set up exactly the way you left it, with no explaining which options to pick. The Embed code carries the same settings into the live widget you drop on your own site, so the version on a blog matches the one you configured.