Skip to content
Processing locally — files never leave your device

CSS Minifier

Minify CSS by removing comments, whitespace, and unnecessary semicolons. See input/output sizes and savings percent.

How to use CSS Minifier

  1. Paste your CSS — a single stylesheet or several concatenated together — into the input box.
  2. Watch the minified output update live as comments and whitespace are stripped.
  3. Check the byte savings reported below the output to confirm the reduction.
  4. Copy the minified CSS and save it as your production .min.css file.
  5. Reference the minified file in your build, and keep the original unminified source under version control.

CSS minification: smaller stylesheets, faster pages

Minifying CSS removes every character a browser does not need to parse your rules — comments, line breaks, indentation, and redundant semicolons — without changing how a single pixel renders. The result is a smaller file that downloads faster and blocks rendering for less time. This tool minifies your CSS in the browser and shows you exactly how many bytes you saved.

What gets removed

Given this readable source:

/* Primary button */
.btn {
  color: #ffffff;
  background: #2563eb;
  padding: 8px 16px;
}

the minifier produces:

.btn{color:#ffffff;background:#2563eb;padding:8px 16px}

The comment is gone, all whitespace between tokens is collapsed, and the final semicolon before the closing brace is dropped because it is optional. The selectors and values are untouched, so the rendered output is byte-for-byte identical.

Why file size matters for SEO

CSS in the <head> is render-blocking: the browser will not paint the page until it has downloaded and parsed it. A smaller stylesheet shortens that wait, which feeds directly into First Contentful Paint and Largest Contentful Paint — two metrics Google uses as part of its page-experience signals. Faster pages also reduce bounce on slow mobile connections, where every kilobyte counts.

Minify, then compress

Minification and HTTP compression are complementary, not alternatives. Minify the file first, then make sure your server or CDN serves it with Brotli (or gzip as a fallback). Minification removes structural redundancy; Brotli then compresses the remaining bytes using a shared dictionary. A 100 KB stylesheet might minify to 70 KB and then compress to around 12 KB on the wire.

Keep your source readable

Never edit minified CSS by hand. Treat the minified file as a build artifact: keep your original, commented, well-indented stylesheet in version control and regenerate the minified version whenever you change it. If you debug in DevTools, ship a source map so the browser can map the compressed rules back to your real lines.

What minification does not do

A minifier compresses the rules you give it; it does not delete rules nothing on the page uses. If your stylesheet has grown bloated with dead rules, pair minification with an unused- CSS tool to purge them first — that often saves far more than minification alone. Minifiers also do not merge duplicate selectors or reorder properties, which keeps the transform safe and predictable.

Related SEO tools

Frequently asked questions

How much smaller does CSS get?
Typically 20–40% smaller, depending on how heavily the source is commented and indented. The bigger win usually comes after this: serving the minified file with gzip or Brotli compression on your server, which can cut it by a further 70–80% over the wire.
Will minified CSS break my site?
For valid CSS, no. The transform only removes comments, redundant whitespace, and unnecessary trailing semicolons — it never changes selectors, property values, or specificity. Always test the minified output in staging before shipping, especially if your CSS contains unusual hacks.
Does minification remove unused CSS?
No. Minification only compresses the bytes of the rules you give it. Removing rules that no element matches (dead-code elimination, sometimes called tree-shaking or purging) is a separate process handled by tools like PurgeCSS — not by a minifier.
Should I minify CSS by hand or in my build?
For a quick one-off or a static page, pasting it here is fine. For an app you deploy regularly, wire minification into your build pipeline (esbuild, Lightning CSS, cssnano, or your bundler) so it runs automatically on every release and never goes stale.
What is the difference between minify and gzip?
Minification removes characters that browsers do not need, producing a smaller source file. Gzip/Brotli is transport compression applied by the server at request time and transparently decompressed by the browser. They stack: minify first, then compress. Together they shrink CSS far more than either alone.
Does minified CSS hurt debugging?
It is harder to read, yes. Keep your readable source in version control and, if you want to debug the minified file in DevTools, generate a source map alongside it so the browser maps minified rules back to your original lines.
Are CSS comments safe to remove?
Almost always. One exception: a license-banner comment that begins with /*! is conventionally preserved by minifiers because it carries legal attribution. If you need to keep such a banner, add it back to the top of the minified file.
Does minifying CSS help Core Web Vitals?
Indirectly. Smaller render-blocking CSS reaches the browser faster, which can improve First Contentful Paint and Largest Contentful Paint. The effect is real but modest compared with deferring unused CSS and reducing the total amount of CSS you ship.

More tools you might find useful in the same flow.

Built by Muhammad Tahir · About