CSS Minifier
Compress CSS.
Loading tool…
What is CSS minification?
CSS — Cascading Style Sheets — is the language that describes how a web page looks: colours, spacing, layout, typography, responsive behaviour. Written for humans, a stylesheet is full of indentation, blank lines, comments, and readable formatting, none of which a browser needs.
Minification removes everything that has no effect on rendering: whitespace between rules, comments, the final semicolon in a block, and unnecessary units on zero values. Shorthand rewrites go further, collapsing #ffffff to #fff and merging duplicate declarations. The output is unreadable to a person and identical to a browser, typically 20 to 40 per cent smaller — and smaller again after gzip, because CSS compresses well. Since stylesheets block rendering, that saving comes off your page's first paint directly.
Why we built this tool
Anyone shipping a site without a full build pipeline still needs minified CSS: a WordPress theme, a landing page, an email template, a static site assembled by hand, or a quick fix deployed straight to a server.
Stylesheets are less sensitive than most files, but they are unreleased work, and pasting a client's unpublished design into an unknown server is still a needless disclosure. Our minifier is written in JavaScript and runs in your tab, so the transformation happens on your device and no request leaves the page. That also removes the practical annoyances of online tools: there is no size cap, no queue, and it keeps working offline once loaded.
Tips and common mistakes
- Keep the readable source in version control and minify as a publishing step, never the other way round.
- Preserve licence comments if any of your CSS comes from a third-party library that requires attribution.
- Test a minified stylesheet with a hard refresh; a cached old file is the usual reason a change appears not to work.
- Enable gzip or Brotli on the server too — the savings compound and the server-side one is usually larger.
Open CSS Minifier with a link
Assistants and scripts can open CSS Minifier with its input already in the link, after the #, which never leaves your device:
#text=— the text to work on
Example: https://mygadgets.ink/tools/css-minifier/#text=... · also compressed gz fields and ?url=. How tool links work
Quick start: using CSS Minifier
- Paste your stylesheet into the input above or load the .css file.
- Run the minifier and compare the original and minified byte counts.
- Copy the output into your production file — keep the readable version as your source.
- Deploy and hard-refresh to confirm nothing shifted visually.
- Enable gzip or Brotli on your server as well; the two savings compound.
Do the same for your scripts with JS Minifier and your markup with HTML Minifier.
What minification removes
A CSS minifier deletes everything the browser does not need:
- Comments — your notes to other developers.
- Whitespace — indentation, line breaks, and spaces around braces and colons.
- Redundant characters — the last semicolon in a block, unnecessary units on zero values.
The rules themselves are untouched, so the page looks and behaves identically — it just arrives as one dense line instead of readable blocks.
How much it saves
Typical CSS shrinks by 10–30% from minification alone, and more once the server also compresses it with gzip or Brotli. On a large stylesheet that is real, measurable load-time savings — and CSS blocks rendering, so a smaller file means the page paints sooner. For a small site the absolute bytes are modest, but the habit is free and scales as the site grows.
Keep your source, ship the minified
The one rule: never edit minified CSS by hand. It is unreadable and impossible to maintain. Keep your original, formatted CSS as the source of truth, edit that, and minify only the version you deploy. In a real build pipeline this happens automatically; for a hand-managed site, minify as the last step before publishing.
Minification vs. other optimizations
Minifying is one lever among several. It pairs well with:
- Server compression (gzip/Brotli) — applied on top, for much bigger gains.
- Removing unused CSS — the biggest win on bloated stylesheets, though it needs analysis of what the site actually uses.
Minify first because it is free and safe; pursue unused-CSS removal when the file is genuinely large.
Common uses
- Speed up page load by shrinking stylesheets.
- Reduce bandwidth on high-traffic sites.
- Prepare CSS for production deployment.