User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
Category CSS Tools
Original 0 B
Compressed 0 B
Saved 0 B (0%)
Ratio 1:1
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

About

Uncompressed CSS inflates page weight and increases Time to First Paint. Every redundant whitespace character, every block comment left from development, every unoptimized hex color like #FFFFFF instead of #FFF adds bytes that browsers must download, parse, and apply before rendering. On mobile connections at 1.6 Mbps effective throughput, a 200 KB stylesheet delays rendering by over 1 s. This tool performs real minification: comment stripping, whitespace collapsing, zero-unit removal, hex shorthand conversion, and empty ruleset elimination. It does not rewrite selectors or merge rules, so output is safe to deploy without regression testing.

Typical compression ratios range from 15% to 40% depending on coding style. Heavily commented, well-formatted source files see the largest gains. Already-minified files may see 0 - 2% further reduction. This tool approximates gzip-level textual savings only. Actual transfer size depends on your server’s Content-Encoding header configuration.

css minifier compress css css optimizer minify css css compressor reduce css size

Formulas

The compression ratio R is computed as the percentage reduction in byte length between the original and minified output:

R = Soriginal βˆ’ SminifiedSoriginal Γ— 100%

Where Soriginal = byte length of input CSS (UTF-8 encoded), and Sminified = byte length of output CSS after all transformations. Byte length uses the TextEncoder API for accurate multi-byte character counting rather than String.length which counts UTF-16 code units.

The minification pipeline applies transformations in a specific order to avoid conflicts: 1) strip comments, 2) preserve string literals, 3) collapse whitespace, 4) optimize values, 5) remove redundant tokens, 6) restore string literals. String and url() content is extracted before processing and reinserted after to prevent corruption of data URIs or quoted content.

Reference Data

OptimizationExample BeforeExample AfterTypical Savings
Remove block comments/* header styles */(removed)5 - 20%
Collapse whitespacemargin: 0 auto ;margin:0 auto10 - 25%
Remove last semicoloncolor:red;}color:red}1 - 3%
Shorten hex colors#AABBCC#ABC0.5 - 2%
Remove zero units0px00.2 - 1%
Shorten leading decimals0.5em.5em0.1 - 0.5%
Remove empty rulesets.a { }(removed)0.1 - 1%
Collapse rgb to hexrgb(255,0,0)red0.5 - 1.5%
Remove unnecessary quotesfont-family: "Arial"font-family:Arial0.1 - 0.5%
Normalize none/0border: noneborder:00.1 - 0.3%
Lowercase keywordsCOLOR: REDcolor:red0% (consistency)
Remove charset if UTF-8@charset "UTF-8";(removed)0.1%
Typical total (formatted source)100 KB65 KB25 - 40%
Typical total (already minified)100 KB98 KB0 - 2%

Frequently Asked Questions

No. The minifier treats @-rules as opaque blocks and only removes whitespace around known safe delimiters (colons, semicolons, braces, commas). It does not restructure or reorder rules. Media query expressions, @keyframes percentages, and @font-face descriptors are preserved. The only @-rule removed is @charset "UTF-8" since browsers default to UTF-8 when no charset is specified.
No. The CSS specification defines #ABC as identical to #AABBCC. The shorthand is expanded by the browser's CSS parser to the same 24-bit color value. Only colors where all three pairs are doubles (e.g., #FF0099 β†’ #F09) are shortened. Colors like #F0E1D2 remain unchanged because the pairs are not uniform.
The CSS specification states that zero lengths, angles, and times may omit their unit. The value 0 is always interpreted correctly regardless of the property context. The one exception is within calc() expressions where units must be preserved for type checking, and this tool does not strip units inside calc().
Yes. Custom property declarations (--my-var: value) and var() references are treated as standard tokens. Whitespace around colons and semicolons is removed, but the variable names and fallback values are left intact. Note that custom property values are case-sensitive, so the tool does not lowercase them.
The tool processes files up to approximately 5 MB in the main thread. For inputs above 500 KB, processing moves to a Web Worker to prevent UI freezing. Browsers typically allocate 50-100 MB for a tab's JS heap, so files up to 10 MB are feasible, but processing time increases linearly. For stylesheets above 5 MB, consider splitting into modules.
No. CSS minification and transport compression are complementary. Minification reduces the source text size, while gzip/Brotli compresses the binary transfer. A 100 KB formatted file might minify to 70 KB, then gzip to 15 KB. Without minification, the same file gzips to roughly 18 KB. Minification typically saves an additional 10-20% on top of transport compression because repeated whitespace patterns that gzip exploits are already removed.