Calculate compression ratio and space savings from uncompressed and compressed sizes. Compare gzip, zstd, LZ4, and other algorithms.
Data compression is one of the most effective ways to reduce storage costs and network bandwidth. A compression ratio of 5:1 means your data occupies one-fifth of the original space—an 80% reduction. Different algorithms (gzip, zstd, LZ4, Brotli, snappy) offer different tradeoffs between compression ratio, speed, and CPU usage.
This calculator computes the compression ratio and percentage of space saved from the uncompressed and compressed sizes. Enter the original and compressed sizes in any unit (bytes, MB, GB), and the tool calculates the ratio, space saved percentage, and the inverse (decompression expansion). It's useful for evaluating compression algorithm choices, estimating storage savings, and planning network transfer reductions.
Whether you're compressing log files, database backups, API payloads, or media assets, understanding your actual compression ratio helps you make informed decisions about which algorithm to use and how much storage to provision.
Understanding this metric in precise terms allows technology leaders to make evidence-based decisions about scaling, architecture, and infrastructure investment priorities for their organizations.
Compression directly reduces storage and bandwidth costs. This calculator quantifies the exact savings so you can compare algorithms, justify compression investments, and accurately size compressed storage. Having accurate metrics readily available streamlines incident postmortems, architecture reviews, and technology roadmap discussions with engineering leadership and product teams. Consistent measurement creates a reliable baseline for tracking system health over time and identifying degradation before it impacts users or triggers costly production outages.
ratio = uncompressed_size / compressed_size; space_saved_pct = (1 − 1 / ratio) × 100 = (1 − compressed / uncompressed) × 100
Result: 5:1 ratio; 80% space saved
1,000 MB uncompressed / 200 MB compressed = 5:1 ratio. Space saved: (1 − 200/1000) × 100 = 80%. If storing 10 TB uncompressed, compression reduces it to 2 TB, saving $184/month at $0.023/GB.
gzip: Universal compatibility, moderate speed, 4–6× ratio. zstd: Modern, fast, 5–8× ratio, configurable levels. LZ4: Ultra-fast compression/decompression, 2–3× ratio. Brotli: Excellent for web content, 5–10×, slower compression. snappy: Google's fast codec, similar to LZ4.
If you store 100 TB at $0.023/GB ($2,300/month), 5× compression reduces storage to 20 TB ($460/month)—saving $1,840/month ($22,080/year). Network savings are similar: compressed data transfers 5× faster on the same bandwidth.
PostgreSQL TOAST automatically compresses large text/bytea values. Elasticsearch uses LZ4 by default, configurable to zstd. ClickHouse supports LZ4 and zstd per column. Choose compression based on the column data type and query pattern.
For text/log data: 4–8× is typical. For JSON: 5–10×. For database dumps: 3–6×. For images (already compressed): 1.0–1.2×. Anything above 3× is considered good for mixed data.
For storage: zstd (best ratio/speed balance). For network: gzip (wide compatibility) or Brotli (best ratio for HTTP). For real-time streaming: LZ4 or snappy (fastest). For archives: zstd level 19 or xz (highest ratio).
Compression reduces I/O by reading fewer bytes from disk, which often offsets the CPU cost of decompression. On SSD-based systems, compression can actually improve read performance. Write performance depends on algorithm speed.
No. Compressing JPEG, PNG, MP4, or ZIP files yields little to no reduction (often < 1%). It may even increase size slightly due to compression headers. Only compress uncompressed source data.
Higher levels find more redundancy at the cost of CPU time. gzip level 1 is ~4× faster than level 9 but achieves 5–15% lower ratio. zstd level 1–3 is extremely fast; levels 15–22 maximize ratio but are much slower.
Both, ideally. Compress in transit to save bandwidth (HTTP gzip, TLS compression). Compress at rest to save storage. Many systems do both transparently—Elasticsearch, PostgreSQL, and cloud storage all support at-rest compression.