Free Online Tool

Online CSS Minifier

Compress CSS by removing whitespace, comments, and extra color digits. You see the size you save as you type.

Size reduced 0%
Saved 0 bytes
Buy me a coffee

Your CSS

0Characters 0Lines 0Bytes 0Rules

Minified CSS

0Characters 0Lines 0Bytes 0Rules

Smart Compression

Removes whitespace, comments, and optimizes colors while preserving CSS functionality.

Instant Results

Real-time minification shows immediate file size reduction and optimization metrics.

Color Optimization

Automatically converts color names to hex and compacts 6-digit hex codes to 3-digit format.

How to Minify CSS

Quick Steps:

  1. 1Paste your CSS into the first box
  2. 2Choose whether to drop comments and compact colors
  3. 3Read the minified CSS in the output box
  4. 4Check the size reduction percentage
  5. 5Copy or download the minified CSS

What Gets Optimized:

  • •
    Whitespace: All unnecessary spaces, tabs, and line breaks removed.
  • •
    Comments: CSS comments removed to reduce file size.
  • •
    Colors: #aabbcc → #abc, color names → hex codes.
  • •
    Zeros: 0px → 0, 0.5 → .5, removes unnecessary unit values.
  • •
    Semicolons: Last semicolon in each rule removed.

Before & After Example

Before Formatted CSS (245 bytes)

/* Button Styles */
.btn {
  padding: 10px 20px;
  background: #0066ff;
  color: white;
  border: 0px solid;
  border-radius: 5px;
}

After Minified CSS (92 bytes — 62% smaller)

.btn{padding:10px 20px;background:#06f;color:#fff;border:0 solid;border-radius:5px}

Color Optimization Examples:

Before:

#aabbcc → #abc color: white → color: #fff 0.5em → .5em padding: 0px → padding: 0

Result:

62% smaller file size Faster page load Less bandwidth Same functionality

Why Minify CSS?

Faster Page Load

Smaller CSS files download faster, improving page load speed and user experience significantly.

Reduced Bandwidth

Save bandwidth costs by serving smaller CSS files, especially important for high-traffic websites.

Production Standard

Minified CSS is industry best practice for production environments and optimization.

SEO Benefits

Faster loading pages rank better in search engines, improving your site's SEO performance.

Best Practices

✅ Do This:

✓Minify CSS for production websites and applications

✓Keep original formatted files for development

✓Use source maps for debugging minified CSS

✓Combine minification with gzip compression

✓Automate minification in your build process

❌ Avoid This:

✗Don't minify CSS during development — keep readable

✗Don't edit minified CSS directly — modify source files

✗Don't commit minified CSS to version control without source

✗Don't minify if you need to debug in production

✗Don't forget to test after minification

Pro Tips

1

Maintain Source Files

Always keep formatted CSS for development and only use minified for production

2

Use Build Tools

Integrate CSS minification into webpack, gulp, or your build pipeline

3

Enable Gzip

Combine minification with server gzip for maximum compression (up to 80-90%)

4

Test Thoroughly

Always test your website after minification to ensure styles render correctly