CSS Minifier
Minify CSS online: remove comments and whitespace, drop trailing semicolons and shorten hex colors. See bytes and percent saved. Free, instant, private.
What is the CSS Minifier?
The ByteTools CSS Minifier shrinks stylesheets by stripping comments, collapsing whitespace, removing the last semicolon in every rule and shortening six-digit hex colors like #ffffff to #fff where the pairs repeat.
- Removes comments and unnecessary whitespace
- Drops trailing semicolons before closing braces
- Shortens #rrggbb hex colors to #rgb where safe
- Preserves strings and calc()-critical spaces
- Shows bytes before, after and percent saved
- 100% client-side — CSS never leaves your browser
How to use the CSS Minifier
- 1
Paste your CSS into the input box.
- 2
Click Minify CSS.
- 3
Review the before/after sizes and percent saved.
- 4
Copy the minified stylesheet or download it as a .css file.
About the CSS Minifier
The ByteTools CSS Minifier shrinks stylesheets by stripping comments, collapsing whitespace, removing the last semicolon in every rule and shortening six-digit hex colors like #ffffff to #fff where the pairs repeat. The before/after size and percentage saved are displayed immediately.
It is deliberately conservative: strings are preserved byte-for-byte, spaces that CSS actually needs — such as those inside calc() expressions and descendant selectors — are kept, and no properties are rewritten or reordered. What comes out is the same stylesheet, just smaller.
Minification runs 100% locally in your browser, so your CSS is never uploaded. Compress production bundles, email styles or theme files without the code leaving your machine.
Frequently asked questions
How much does CSS minification reduce file size?
Hand-written stylesheets typically shrink by 15–40% depending on commenting and indentation style. Combined with gzip or Brotli on the server, the transferred size drops even further, since minification and compression work on different kinds of redundancy.
Is it safe to minify CSS — can it break styles?
This minifier only removes things CSS ignores: comments, optional whitespace and redundant semicolons. It keeps required spaces (like around + and - inside calc()) and never rewrites values, so the rendered result is identical to the original.
Why does #ffffff become #fff?
When each pair of hex digits repeats (ff-ff-ff), CSS allows a three-digit shorthand that means exactly the same color. The minifier applies this only when the pairs genuinely repeat, so #f8f9fa is left untouched.
Should I keep an unminified copy of my CSS?
Yes. Treat minified CSS as a build artifact: edit the readable source, minify for deployment. If you only have the minified file, the CSS Formatter on this site can expand it back into a readable layout.
Does the minifier upload my stylesheet?
No. Everything happens in your browser with client-side JavaScript. The CSS is never transmitted or stored, so proprietary design code stays private.
Guides for CSS Minifier
Related tools
CSS Formatter
Format and beautify CSS online: one declaration per line, tidy indentation, spaces after colons and support for nested at-rules. Free and 100% private.
HTML Minifier
Minify HTML online: strip comments, collapse whitespace between tags and shrink page size. See bytes saved instantly. Free, private, runs in your browser.
JavaScript Minifier
Minify JavaScript online safely: strip comments and collapse whitespace without renaming or rewriting code. See bytes saved. Free and 100% in-browser.
Image Compressor
Compress JPG, PNG and WebP images in your browser with an adjustable quality slider. See before/after file size and download the smaller image free.