CSS Minifier Online
Shrink your stylesheets for faster page loads — comments stripped, whitespace collapsed, zero units and hex colors shortened. Private by design: everything runs in your browser.
178 chars in → 112 chars out (37% smaller)
Safe by design: strings, url() values and /*! … */ license comments are preserved exactly. The minifier strips comments, collapses whitespace, drops the last semicolon in each rule, removes units from zero values (0px → 0), and shortens hex colors (#ffffff → #fff).
Related guide
Read guide: CSS minifier (safe minification, size savings, workflow) →
Minify CSS (free, no signup)
CSS is render-blocking: the browser will not paint your page until the stylesheet has downloaded and parsed. Every comment, blank line, and unnecessary character in that file is dead weight your visitors download on every first visit. Minification strips all of it — comments, whitespace, redundant semicolons, verbose values — producing a compact file that renders pixel-identically and arrives faster.
This free CSS minifier compresses your stylesheet in one paste: comments removed, whitespace collapsed, the trailing semicolon in each rule dropped, 0px shortened to 0, and #ffffff shortened to #fff. A live readout shows your exact byte saving (hand-written stylesheets typically shrink 20–40%), so you can see the payoff before you deploy.
Safe minification: what it will not touch
Cheap minifiers break stylesheets by treating CSS as dumb text. This one parses with awareness of the language's danger zones:
- Quoted strings are sacred. content: "a; b" contains a semicolon and spaces that are part of the value, not separators — a naive minifier would mangle it. This tool leaves strings byte-for-byte intact.
- url() values are preserved, including data URIs and paths with special characters.
- License headers survive. Comments written as /*! … */ (the convention for copyright and license notices) are kept by default — stripping someone's license header can violate the license terms. A checkbox lets you remove even those if you want every last byte gone and you own the code.
How to minify in 3 steps
- Paste your CSS into the input box (a starter sample is preloaded so you can see it work instantly).
- Decide on license comments: leave “Keep important comments” on for third-party or licensed code; switch it off for your own code when squeezing maximum bytes.
- Copy the minified output and deploy it as style.min.css, keeping your readable style.css as the source of truth.
Where minified CSS pays off most
- Production deploys: the classic workflow — develop in readable CSS, ship the minified build. Most build tools do this automatically, but for static sites, quick fixes, and CMS custom CSS, a manual minifier is faster than setting up a pipeline.
- Core Web Vitals: smaller CSS means faster First Contentful Paint and less render-blocking time — both feed into Google's page-experience signals.
- Email HTML: email clients are picky and inlined styles bloat fast; minifying the CSS before inlining keeps templates lean.
- Cleaning experiments: hand-written stylesheets accumulate commented-out attempts. Minification sweeps them away in the shipped file while your source keeps the history.
Before and after: what actually disappears
To make the savings concrete, here is a typical rule going through the minifier. Before:
.card { margin: 0px auto; background-color: #ffffff; } /* container */
After: .card{margin:0 auto;background-color:#fff}. The comment is gone, the zero lost its unit, the hex shrank, and the trailing semicolon vanished — while auto kept its spacing because removing it would glue two values together. Multiply that across hundreds of rules and the 20–40% saving becomes easy to believe.
Minify is not the whole performance story
Minification shrinks bytes, but two bigger wins often hide nearby: removing unused CSS rules entirely (a minifier cannot know what your HTML actually uses), and serving the file with gzip or Brotli compression (which stacks with minification). Think of minification as the cheapest, safest step — do it always, then chase the bigger wins when performance really matters.
Your stylesheet stays yours
Stylesheets can be proprietary — client work, premium themes, unreleased designs. This minifier runs wholly in your browser, so your CSS is never uploaded to any server. Paste with confidence, even for code under NDA.
Common use cases
- Shrink stylesheets before deploying to production
- Improve Core Web Vitals by cutting CSS download size
- Clean up commented-out experiments from hand-written CSS
- Prepare a style.min.css alongside your readable style.css
Minifying the markup too? ToolsOfWeb’s HTML Formatter minifies HTML the same safe way. For API payloads, the JSON Formatter minifies JSON with one click.
FAQs
A CSS minifier shrinks your stylesheet by removing everything the browser does not need: comments, extra whitespace, the last semicolon in each rule, units on zero values (0px → 0), and long hex colors (#ffffff → #fff). The styles render identically — the file is just smaller and downloads faster.
No. Minification runs entirely in your browser. Your stylesheet never leaves your device, which makes this safe for proprietary or client CSS.
A safe minifier never touches the parts that matter: quoted strings, url() values, and /*! … */ important comments (often license headers) are preserved byte-for-byte. This tool keeps all three intact.
It depends on how the CSS was written. Hand-written stylesheets with comments and generous spacing typically shrink 20–40%. Already-compact CSS shrinks less. The tool shows your exact saving live as you paste.
Indirectly. Smaller CSS files load faster, and page speed is a Google ranking factor (Core Web Vitals). Minification is one of the cheapest performance wins on any site.
More free tools
HTML Formatter
Client-side • No sign-up
JSON Formatter
Client-side • No sign-up
Base64 Encode & Decode
Client-side • No sign-up
Text Diff Checker
Client-side • No sign-up
Text Cleaner
Client-side • No sign-up
Meta Tag Generator
Client-side • No sign-up
Want guides and tips? Visit the ToolsOfWeb blog or go back to the homepage.
Related guide
Read guide: CSS minifier (safe minification, size savings, workflow) →
