Minify, Unminify & Beautify CSS Online — Free CSS Minifier

Minify, unminify and beautify your CSS code instantly to improve your website performance. Our free online CSS minifier removes unnecessary spaces, optimizes selectors and merges duplicate rules. Secure and private processing, directly in your browser.

Loading...
CSS Minification
Minify, unminify and beautify your CSS code with CSSO. Free online tool to optimize, compress and format your CSS stylesheets.

Features

Our CSS tool offers three main features:

Minify

Reduce the size of your CSS code by removing spaces, comments and unnecessary characters.

Unminify

Restore the readability of your minified CSS code by adding spaces and line breaks.

Beautify

Format and beautify your CSS code with customizable indentation (2 or 4 spaces, or tabs).

Package used

CSSO
v7.0.0

CSSO (CSS Optimizer) is a powerful tool for optimizing CSS files by removing redundancies and compressing code.

Basic example

Input CSS

.container { margin: 20px; padding: 10px; background-color: #ffffff; } .button { color: #000000; font-size: 16px; border: 1px solid #cccccc; }

Minified CSS

.container{margin:20px;padding:10px;background-color:#fff}.button{color:#000;font-size:16px;border:1px solid #ccc}

Minification options

Compression Level
Controls the aggressiveness of CSS compression
ConservativeConservative - Basic optimizations only
NormalNormal - Balance between size and compatibility
AggressiveAggressive - Advanced optimizations, may affect compatibility
Remove Comments
Removes all CSS comments from code

Comparison with/without option:

Original code
/* Header styles */ .header { background: #fff; padding: 20px; } /* Navigation */ .nav { display: flex; }
With removeComments: true
.header{background:#fff;padding:20px}.nav{display:flex}
With removeComments: false
/* Header styles */.header{background:#fff;padding:20px}/* Navigation */.nav{display:flex}
Difference
CSS comments are removed
Convert Colors
Converts colors to their shortest format

Comparison with/without option:

Original code
.button { background: #ff0000; color: rgb(255, 255, 255); border: 1px solid hsl(0, 100%, 50%); }
With convertColors: true
.button{background:red;color:#fff;border:1px solid red}
With convertColors: false
.button{background:#ff0000;color:rgb(255,255,255);border:1px solid hsl(0,100%,50%)}
Difference
Colors are converted to shortest format
Merge Rules
Merges identical and adjacent CSS rules

Comparison with/without option:

Original code
.header { background: #fff; padding: 20px; } .header { margin: 10px; }
With mergeRules: true
.header{background:#fff;padding:20px;margin:10px}
With mergeRules: false
.header{background:#fff;padding:20px}.header{margin:10px}
Difference
Identical CSS rules are merged
Minify Selectors
Optimizes CSS selectors to reduce their size

Comparison with/without option:

Original code
div.container > ul li:first-child { color: red; } div.container > ul li:last-child { color: blue; }
With minifySelectors: true
div.container>ul li:first-child{color:red}div.container>ul li:last-child{color:blue}
With minifySelectors: false
div.container > ul li:first-child{color:red}div.container > ul li:last-child{color:blue}
Difference
CSS selectors are optimized
Beautify Options
Options for formatting and beautifying CSS (Beautify only, not for Minify/Unminify)

Indentation Size

Sets the number of spaces or tabs for indentation during Beautify

Original code
.header{color:red;padding:10px}
With 2 spaces
.header { color: red; padding: 10px; }
With 4 spaces
.header { color: red; padding: 10px; }
Difference
Indentation is customizable only for Beautify. Unminify always uses 2 spaces.

Indentation Type

Use spaces or tabs for indentation during Beautify

Original code
.header{color:red;padding:10px}
With spaces
.header { color: red; padding: 10px; }
With tabs
.header { color: red; padding: 10px; }
Difference
Spaces are more standard, tabs may be preferred according to your code conventions.

Other minification tools

Minify, Unminify & Beautify CSS Online — Free CSS Minifier Tool