Free CSS Minifier

Minify CSS & Trim Your Stylesheet

Strip comments, collapse whitespace, shorten hex colours, and remove empty rules — all in a single click, with no account required.

/* Before: 4.8 KB */
.hero {
background:#be185d;
padding:0px;
}
✓ After: 1.8 KB — 62% smaller
Actions:
6 minifications left today
INPUT.css
OUTPUT.min.css
Minified CSS will appear here…
Paste CSS to begin
0 chars · 0 lines

What is CSS Minification?

CSS minification strips everything from your stylesheet that a browser does not need to apply styles — block comments, indentation, blank lines, and unnecessary whitespace around colons, semicolons, and braces. It also shortens redundant values like 0px to 0 and compresses six-character hex colours like #ffffff to #fff. The output is byte-for-byte equivalent in terms of rendering; it just weighs less on the wire.

A typical CSS file can shrink by 20–60% through minification alone. Combine that with server-side GZIP or Brotli compression and the transfer size can drop to a fraction of the original. For sites loading multiple stylesheets, these savings compound across every page view.

What Our CSS Minifier Actually Does

1. Removes All Comments

Every /* ... */ block is stripped out. Comments are purely for developers and add zero value to what the browser renders.

2. Collapses Whitespace

Multiple spaces, tabs, and line breaks are collapsed to the bare minimum. Indentation and blank lines disappear entirely.

3. Shortens Zero Values

Values like 0px, 0em, and 0rem become just 0. The unit after zero is meaningless and the browser knows it.

4. Compresses Hex Colours

Colours like #aabbcc are shortened to #abc where possible. This is a guaranteed lossless transform that browsers handle natively.

5. Removes Empty Rules

Selectors with empty declaration blocks like .unused {} are deleted. They contribute to parse time without affecting any element.

6. Shows Savings Stats

After minification you get a breakdown: original size, minified size, bytes saved, percentage reduction, comments removed, and rule count.

Why CSS File Size Affects Your Google Rankings

Render-Blocking Resources

CSS in the blocks first paint. A smaller stylesheet is fetched and parsed faster, which directly improves Time to First Byte and Largest Contentful Paint — both Core Web Vitals Google measures.

Mobile Page Experience

PageSpeed Insights and Lighthouse both flag oversized CSS files as "Eliminate render-blocking resources." Fixing this audit item can meaningfully move your mobile performance score.

CDN & Cache Efficiency

Smaller files have higher cache-hit ratios on CDN edge nodes and compress further with Brotli. Returning visitors load your site from cache faster, reducing server load.

Hosting Cost Reduction

If you are on a bandwidth-metered plan or pay per GB transferred on a cloud provider, shaving 40% off every stylesheet request adds up meaningfully at scale.

5 CSS Minification Pitfalls Worth Knowing

  • Editing the minified file directly

    Always maintain a human-readable source file and minify at build or deploy time. Editing .min.css directly means your next deploy will overwrite your changes and you will have no readable reference.

  • Minifying third-party vendor CSS manually

    Bootstrap, Tailwind, and similar frameworks already ship minified builds. Feeding their source through a second minifier is harmless but wasteful — just use their .min.css distribution.

  • Missing CSS custom property compatibility

    Minifiers that aggressively rewrite values can occasionally break CSS custom properties (variables) or calc() expressions. Always test in a browser after minifying complex stylesheets.

  • Not using source maps in production debugging

    When you serve minified CSS, browser DevTools will show you a single unreadable line. Generate a .css.map file during your build so errors still point to the original source line.

  • Forgetting media query whitespace rules

    Some aggressive minifiers remove spaces inside media queries in ways that break older browser parsing. Our tool preserves spaces correctly so @media (max-width: 768px) stays valid.

Frequently Asked Questions

Not if it is done correctly. Our minifier only removes characters that have no effect on rendering. Empty rules are deleted, zero units are stripped, and equivalent hex values are compressed — none of these changes affect visual output. That said, always test in a staging environment before deploying to production.

It depends on how the original file was written. Heavily commented stylesheets with consistent indentation routinely see 30–55% savings. Stylesheets that were already compact might only shrink by 10–15%. The stats panel shows your exact numbers immediately after minification.

Yes. Minification removes unnecessary characters before the file is sent. GZIP is applied at the server or CDN level and compresses the file for transfer. Both are complementary — minification gives GZIP fewer bytes to start with, and GZIP compresses the remaining content further.

No — this tool processes plain CSS. For SCSS or Less you should compile to CSS first using a build tool like Sass or PostCSS, then minify the resulting CSS output either here or in your build pipeline.

CSS custom properties like --primary-color: #be185d; are preserved correctly. Our minifier removes whitespace around colons and semicolons without breaking variable declarations or var() usage.

Yes. Minifying all three file types compounds the savings. Try our HTML Minifier and our JSON Validator for the rest of your front-end assets.

Lighter stylesheets, faster pages.

Paste your CSS above and see how much you can trim in under a second.

Minify CSS Now