Skip to content

CSS Minifier

✨ Minifies as you type 0 B

Minified CSS

Comments and extra spaces are removed. Your styles work the same.

CSS Minifier – Free Online Tool

What is a CSS Minifier?

A CSS minifier makes your stylesheet smaller without changing a single style. While you write CSS, comments, indentation and line breaks help you find your way around. The browser doesn’t need any of that, so before you ship your site you can strip it out and send fewer bytes to every visitor.

CSS is render-blocking: the browser waits for your stylesheet before it draws the page. So a smaller CSS file doesn’t just save bandwidth, it helps the page show up sooner, especially on slow phone connections. Paste, copy, done. Everything runs in your browser, so your code never leaves your device.

How to Use It – Step by Step

Three quick steps, plus a few examples so you know exactly what happens to your code.

Step 1 Paste or Open Your CSS

Put your CSS in the left panel. Any of these work:

  • Paste it: copy from your editor, a theme or a <style> block.
  • Open a file: click the upload button or drag a .css file onto the page.
  • Sample: loads a typical indented stylesheet so you can see the savings right away.

Step 2 Watch It Shrink

The minified CSS appears on the right as you type, with the numbers above it: the original size, the minified size, how much you saved, and the gzipped size (roughly what visitors really download).

Example: comments, spaces and the last semicolon go away (47% smaller)

Before:

/* ===== Navigation ===== */
.nav > a {
  color: #ffffff;
  padding: 8px 12px;
  opacity: 0.85;
}

.nav > a:hover {
  opacity: 1;
}

After:

.nav>a{color:#fff;padding:8px 12px;opacity:.85}.nav>a:hover{opacity:1}

💡 Look closely: #ffffff became #fff and 0.85 became .85. Same color, same number, fewer characters.

Example: calc() keeps the spaces it needs

Before:

.sidebar {
  width: calc(100% - 2 * var(--gap));
  margin: 0 auto;
}

After:

.sidebar{width:calc(100% - 2*var(--gap));margin:0 auto}

💡 Inside calc(), the spaces around + and - are required. Without them the browser ignores the whole value. A careless minifier that removes them breaks your layout. This one keeps them (and safely drops the ones around *).

Step 3 Copy or Download

Click Copy and paste the result into your project, or Download a .min.css file. Keep your original, readable file for editing, and only ship the minified copy.

Good to know: license comments are kept

Comments that start with /*! are a convention for license and copyright notices, so the minifier keeps them and removes the rest:

Before:

/*! Bean UI v2.1 | MIT License */

/* Colors */
.btn { color: #333333; }

After:

/*! Bean UI v2.1 | MIT License */.btn{color:#333}

Need to read a minified file later? Paste it into the CSS Formatter to get clean indentation back, or check it for mistakes with the CSS Validator. Minifying HTML too? There’s an HTML Minifier for that.

Frequently Asked Questions

Will minifying change how my page looks?

No. The minifier only removes things the browser ignores: comments, line breaks, indentation, extra spaces and the last semicolon in each block. It also shortens a few values that mean exactly the same thing, like #ffffff to #fff and 0.5 to .5. Your selectors, properties and values work the same.

What exactly gets removed?

Comments (except /*! ... */ license comments, which are kept on purpose), whitespace that isn’t needed, empty rules like .a {}, extra semicolons and the last semicolon before each }. Strings, url(...) values and escaped characters like .sm\:flex are never touched.

Is it safe with calc()?

Yes. Inside calc(), min(), max() and clamp() the spaces around + and - are required, so the minifier keeps them: calc(100% - 20px) stays as it is. Spaces around * and / aren’t needed, so those go.

How much smaller will my CSS get?

Hand-written, nicely indented CSS with comments usually shrinks by 20–40%. The Saved number above the output shows your exact result, and the gzipped size shows roughly what visitors actually download.

Can I get my readable CSS back?

Almost. Paste the minified CSS into the CSS Formatter and it’s nicely indented again in a second. The comments are gone for good, though, so always keep your original source file and only ship the minified copy.

Should I minify CSS by hand or in my build?

If your project has a build step (Vite, webpack, Parcel, a framework CLI), it probably minifies CSS for you already. This tool is handy for everything else: a WordPress theme, a quick landing page, a CSS snippet for an email, or checking what your build tool would save.

Is my CSS uploaded?

No. Minifying happens entirely in your browser. Nothing is sent to our server.