CSS Minification — Complete Guide
Free Online CSS Beautifier & Minifier
Beautify or minify CSS instantly. Runs entirely in your browser — no uploads.
Open CSS Beautifier & Minifier →What is CSS minification?
CSS minification is the process of removing all unnecessary characters from CSS code — whitespace, line breaks, comments, and redundant semicolons — without changing the code's functionality. The result is a smaller file that loads faster.
.hero {
display: flex;
flex-direction: column;
align-items: center;
/* center the content */
padding: 60px 24px;
background-color: #0a0a0f;
color: #e8e8f0;
}.hero{display:flex;flex-direction:column;align-items:center;padding:60px 24px;background-color:#0a0a0f;color:#e8e8f0}How much does minification save?
Typical CSS minification saves 20–40% of the original file size. Combined with gzip compression (which most web servers apply automatically), the total savings can be 70–80% compared to uncompressed, unminified CSS.
| File | Original | Minified | Minified + gzip |
|---|---|---|---|
| Bootstrap 5 | 195 KB | 159 KB (−18%) | 27 KB (−86%) |
| Tailwind (full) | 3,700 KB | 2,900 KB (−22%) | 300 KB (−92%) |
| Typical app CSS | 50 KB | 32 KB (−36%) | 9 KB (−82%) |
What does CSS minification remove?
- Comments —
/* ... */blocks are removed entirely - Whitespace — spaces, tabs, and newlines between declarations
- Last semicolons — the final semicolon in a rule block is optional
- Leading zeros —
0.5embecomes.5em - Hex colour shortening —
#aabbccbecomes#abc - Zero units —
0pxbecomes0 - Redundant quotes —
font-family: "Arial"may becomefont-family:Arial
How to minify CSS online for free
- Open the CSS Beautifier & Minifier on tinybench.dev
- Click the Minify tab
- Paste your CSS into the input panel
- Click Minify — the output appears instantly
- Copy the minified CSS or use the "Use as input" button to chain operations
CSS minification in build tools
For production projects, CSS minification is typically automated as part of a build pipeline:
// Vite minifies CSS automatically in production builds // Run: vite build
npm install cssnano postcss-cli --save-dev
// postcss.config.js
module.exports = {
plugins: [require('cssnano')({ preset: 'default' })]
}npm install css-minimizer-webpack-plugin --save-dev
// webpack.config.js
optimization: {
minimizer: [new CssMinimizerPlugin()]
}CSS beautifier — the reverse operation
When you receive minified CSS — from a vendor library, a generated stylesheet, or legacy code — the CSS beautifier restores it to readable, formatted code. The tinybench.dev CSS beautifier adds proper indentation, line breaks, and formatting with configurable indent size and property sorting.
Frequently asked questions
Try it now — free & private
Runs entirely in your browser. No sign-up, no uploads, no tracking.
Open CSS Beautifier & Minifier →