The CSS minifier compresses your stylesheet by stripping out everything a browser does not need — comments, indentation, line breaks, and redundant spaces and semicolons — leaving functionally identical CSS in a fraction of the bytes. Paste your styles and get minified, production-ready CSS back instantly, along with a clear breakdown of exactly how much you saved.
Smaller stylesheets download faster, and because CSS blocks rendering, size is one of the few performance levers you control directly. The minifier runs entirely in your browser, so your code is never uploaded anywhere.
What This CSS Minifier Does
Minification is the process of removing all the characters in source code that exist purely for human readability but have no effect on how the browser interprets it. In CSS, that means deleting /* comments */, collapsing the whitespace you use to indent and space out rules, removing the newline after every declaration, trimming the spaces around colons, semicolons, braces, and commas, and dropping the final semicolon before each closing brace since it is optional. The result renders exactly the same as the original but is meaningfully smaller.
The minifier tracks whether it is inside a quoted string while it works. Text inside "..." or '...' is copied byte for byte, so a space in content: "hello world" is never collapsed and content: "/* not a comment */" is not mistaken for a comment (the default sample demonstrates this). Naive find-and-replace minifiers break exactly these cases. The tool does not give unquoted url() values any special treatment, so quote paths that contain spaces. It also does not parse CSS fully, which is why it has the limits listed below.
How to Use It
- Paste your CSS. Drop a rule, a component's styles, or an entire stylesheet into the input box.
- Click Minify CSS. The tool compresses as you type and shows the result immediately.
- Review the savings. The panel shows original and minified byte counts and the percentage saved.
- Copy the output. Click "Copy Minified CSS" to grab the compressed version.
- Deploy it. Use the minified CSS in production while keeping your readable source for editing.
Why Minifying CSS Matters for Performance
Every byte your site sends is a byte the visitor's browser must download before it can render the page, and CSS is render-blocking — the browser will not paint content until it has processed the stylesheet. That makes CSS size one of the more direct levers on perceived load speed, especially on mobile connections where bandwidth is limited and latency is high. How much you save depends on how heavily your source is commented and indented; the sample in the tool saves 28.8%. A smaller stylesheet gives the browser less to download and parse before it can paint.
Minification stacks with other optimisations rather than replacing them. Servers usually apply Gzip or Brotli compression on top, and while those algorithms already handle repetitive whitespace well, minification still reduces the pre-compression size and removes comments entirely (which compression only shrinks, not eliminates). Combined with serving over HTTP/2 and caching aggressively, minifying CSS is one of the cheapest, lowest-risk performance wins available, which is why most build pipelines do it automatically.
Worked Example With the Default Inputs
The tool loads with a 243-byte sample: a /* Button styles */ comment, a .btn rule with five declarations plus a content string that looks like a comment, and a .btn:hover rule. Minified, it becomes:
.btn{display:inline-block;padding:12px 24px;background-color:#1B3A6B;color:#ffffff;border-radius:8px;content:"hello /* not a comment */"}.btn:hover{background-color:#E8A020}
That is 173 bytes, so the panel shows 243 original bytes, 173 minified bytes, 70 bytes saved, 28.8% saved and 1 comment removed. The comment inside the content string is correctly left alone and not counted. The arithmetic is 70 / 243 = 28.8%, rounded to one decimal.
How to Read the Result
- Size saved is bytes saved divided by original bytes. It cannot go below 0%: if your CSS is already minified the tile shows 0%.
- Bytes are UTF-8 bytes, which is what a server sends, not character counts.
- Comments removed counts real comments only, not
/* */text inside quoted strings. - These figures are before Gzip or Brotli. The size over the network will be smaller still, and the gap between minified and unminified shrinks after compression.
Presets to Try
Paste each input to see the exact result.
| Input | Minified output | Bytes (before to after) | Saved |
|---|---|---|---|
a { color : red ; } with line breaks | a{color:red} | 22 to 12 | 45.5% |
/* reset */ * { margin: 0; padding: 0; } | *{margin:0;padding:0} | 41 to 21 | 48.8% |
p > span + em { color: #fff; } | p>span+em{color:#fff} | 30 to 21 | 30.0% |
.a{margin:0} (already minified) | .a{margin:0} | 12 to 12 | 0% |
Known Limits: Check These Before You Deploy
This is a character-level minifier, not a full CSS parser. Test the output when your CSS includes any of these:
- Handled for you: spaces around
+and-insidecalc()are kept, socalc(1px + 2px)stays valid, and.a :hover(any hovered descendant) keeps its space instead of turning into.a:hover. - Unquoted
url()values get no special protection. Quote any path that contains spaces or colons. - It does not shorten colours, merge rules or remove unused CSS.
What to Do Next
- Keep your readable source in version control and treat the minified output as a build artefact.
- Quote any unquoted
url()path that contains spaces or colons before you minify. - Load the minified file on a staging page and compare it visually with the original.
- Enable Gzip or Brotli on your server so the saving stacks.
What Minification Does Not Change
It is worth being precise about the guarantee minification makes: the output is functionally identical to the input. It does not rename your classes, reorder your rules, merge selectors, remove properties it thinks are unused, or change any values — all of which are the job of heavier optimisation tools and carry real risk of changing behaviour. Pure minification only removes characters that the CSS grammar treats as insignificant, so cascade order, specificity, and every computed style remain exactly as you wrote them. That predictability is why it is safe to run on any stylesheet without auditing the result rule by rule.
This also means minification is not a substitute for writing lean CSS in the first place. It will faithfully compress redundant rules, unused selectors, and overly specific declarations right along with the good stuff. The biggest wins come from pairing minification with occasional manual cleanup — removing dead rules, consolidating duplicated declarations — and then letting the minifier handle the mechanical byte-squeezing. Think of it as the final polish on already-reasonable CSS, per the property and value rules documented in the MDN CSS reference.
Where This CSS Minifier Is Useful
- Shipping to production — compress your final stylesheet before deploying to reduce load time.
- Improving Core Web Vitals — smaller render-blocking CSS helps First Contentful Paint and Largest Contentful Paint.
- Inlining critical CSS — minify the small critical block you inline into the
<head>so it adds as few bytes as possible. - Email and embed snippets — fit styles into tight size budgets where every byte counts.
- Quick one-offs — minify a snippet without setting up a full build tool.
Arb Digital designs and builds websites for clients worldwide, with asset optimisation included in the work. See our web design service for what that covers.
See Web Design Services All Free ToolsMinify in Production, Keep Readable Source
The golden rule of minification is that it is a one-way, build-time transformation, never how you maintain code. Minified CSS is deliberately unreadable — no comments, no indentation, everything on as few lines as possible — which makes it miserable to edit and debug directly. The right workflow is to author your CSS in a readable, well-commented source file, keep that in version control, and run minification as an automated step that produces the compressed file you actually deploy. That way you always have a maintainable original, your diffs stay clean, and the byte-squeezing happens without any human ever having to look at the result.
If you are working without a build system, this tool fills the gap: edit your readable CSS, paste it here when you are ready to publish, and copy the minified output into production. Just remember to keep editing the readable version and re-minifying, rather than patching the compressed file, so you never lose the source you can actually work with. Because everything happens locally in your browser, you can do this with proprietary or client CSS without it ever touching a third-party server.
Related Free Tools From Arb Digital
Pair this with the CSS Gradient Generator, Box Shadow Generator, and Flexbox Generator to build styles, then minify them here. Minify scripts with the JS Minifier, and browse the full free online tools hub for more developer utilities.
Minification, Compression, and Bundling: Three Different Things
It is easy to conflate the performance techniques that shrink CSS, but they operate at different layers and stack together. Minification, what this tool does, removes insignificant characters from the source text itself — comments and whitespace — producing smaller but still-valid CSS. Compression (Gzip or Brotli) is applied by the web server at transfer time and uses algorithms that find and encode repeated patterns, shrinking the bytes that travel over the network without changing the stored file. Bundling combines many CSS files into one to reduce the number of separate requests a browser must make.
Because they work at different levels, the smart move is to use all three rather than choosing between them: bundle related stylesheets, minify the result, and let the server compress it on the way out. Minification still matters even with strong server compression, because comments carry no useful redundancy for compression to exploit — they are pure overhead that only removal eliminates — and stripping whitespace lowers the baseline the compressor starts from. Together the three techniques routinely cut CSS payloads to a fraction of their development size.
Critical CSS and the Render Path
Minification pairs especially well with a technique called critical CSS, which targets the single biggest CSS-related slowdown: render-blocking. Because a browser will not paint the page until it has downloaded and processed the stylesheets referenced in the <head>, a large external CSS file delays first paint even if most of its rules apply to content far down the page. The critical-CSS approach extracts just the styles needed to render what is initially visible ("above the fold"), inlines that small block directly into the HTML, and loads the full stylesheet asynchronously afterward.
That inlined critical block is precisely where minification earns its keep, because every byte of it is added to the HTML of every page load and cannot be cached separately. Minifying it keeps the inline payload as small as possible while still unblocking the first paint. The broader lesson is that CSS performance is not one problem but several — total size, render-blocking, and request count — and minification is the cheap, safe, always-worth-doing baseline that the more advanced techniques build on top of.
Frequently Asked Questions
It removes comments, whitespace, line breaks, and unnecessary semicolons from your stylesheet, producing functionally identical CSS in far fewer bytes so it downloads and renders faster.
Usually not. The tool removes comments, extra whitespace and the last semicolon in each block, and it keeps quoted strings exactly. It also keeps the spaces CSS needs around + inside calc() and in a descendant selector like ".a :hover". It is a character-level tool, not a full parser, so test the output before you deploy.
It depends on how much whitespace and how many comments your source has. The built-in sample shrinks from 243 to 173 bytes, a 28.8% saving. Code that is already minified saves 0%. The tool shows your exact figures after minifying.
Yes. Gzip and Brotli compress whitespace well but do not remove comments entirely, and minification reduces the size before compression, so the two stack for a smaller final payload.
You can, but it is difficult because minified CSS has no comments or formatting. Keep a readable source copy and re-minify it whenever you make changes, rather than editing the compressed file.
No. The entire minification runs locally in your browser using built-in JavaScript, so your code is never uploaded, stored, or transmitted anywhere.
This tool runs entirely in your browser using built-in JavaScript. Nothing you type or paste is uploaded, stored, or sent to any server.