compress CSS Minifier

Minify CSS code to reduce file size with compression stats and multiple optimization options

0 characters

tune Minification Options

upload_file Upload CSS File

Drag and drop or click to upload a .css file

cloud_upload

Drop CSS file here or click to browse

quick_reference Minification Transformations

/* comment */
arrow_forward
(removed)
#ffffff
arrow_forward
#fff
margin: 0px;
arrow_forward
margin:0
opacity: 0.5;
arrow_forward
opacity:.5
font-weight: bold;
arrow_forward
font-weight:700
color: rgb(255,0,0);
arrow_forward
color:red

About the CSS Minifier

Minify your CSS code instantly with our free online tool. CSS minification reduces file size by removing unnecessary characters like whitespace, comments, and redundant semicolons without changing functionality. Smaller CSS files mean faster page loads and better Core Web Vitals scores.

What is CSS Minification?

CSS minification is the process of removing all unnecessary characters from CSS code to reduce its size. This includes whitespace (spaces, tabs, newlines), comments, and sometimes redundant code. The minified CSS functions identically to the original but loads faster because browsers download fewer bytes.

Key Features

  • Whitespace Removal — Eliminates spaces, tabs, and line breaks between rules and declarations
  • Comment Removal — Strips all CSS comments (/* ... */)
  • Semicolon Optimization — Removes the last semicolon before closing braces
  • Zero Unit Stripping — Converts 0px, 0em, 0% to just 0
  • Color Shortening — Converts #ffffff to #fff, rgb(255,0,0) to red
  • Leading Zero Removal — Converts 0.5 to .5
  • Font Weight Optimization — Converts bold to 700, normal to 400
  • Compression Statistics — Shows original size, minified size, and savings percentage

Minification Presets

Preset Description Best For
Safe Only whitespace and comments removal When you need to preserve exact values
Default All standard optimizations enabled Most production use cases
Aggressive Maximum compression including empty rule removal When every byte counts

Why Minify CSS?

  • Faster Page Loads — Smaller files download quicker, especially on slow connections
  • Better SEO — Page speed is a Google ranking factor; faster sites rank higher
  • Reduced Bandwidth — Save server bandwidth and reduce hosting costs
  • Improved Core Web Vitals — Better LCP, FID, and CLS scores
  • Lower Carbon Footprint — Less data transferred means less energy consumed

Best Practices

  • Always keep your original, unminified CSS for development
  • Minify CSS as part of your build/deployment process
  • Use source maps in development to debug minified CSS
  • Combine minification with gzip/brotli compression for maximum savings
  • Consider CSS-in-JS or utility frameworks that tree-shake unused styles

Typical Compression Results

CSS minification typically achieves 15-30% size reduction. Combined with gzip compression, total savings can reach 70-85%. For example:

  • Original CSS: 100 KB
  • After minification: ~75 KB (25% savings)
  • After gzip: ~18 KB (82% total savings)

Privacy & Security

All CSS minification happens directly in your browser using JavaScript. Your code is never sent to any server, making this tool completely safe for proprietary or sensitive stylesheets.