Compression Ratio Calculator

Calculate compression ratio and space savings from uncompressed and compressed sizes. Compare gzip, zstd, LZ4, and other algorithms.

Compression Ratio
5.00:1
1,000.0 → 200.0 MB
Space Saved
0.8%
800.00 MB freed
Compressed Size %
0.2%
of original size
Bits per Byte
1.60
2.32 bits of self-information
Monthly Savings
$18.40
1,000.0 GB → 200.0 GB
Annual Savings
$220.80
At $0.02/GB/mo

Compression Visual

0.2%
0.8% saved

Algorithm Comparison (Estimated)

AlgorithmTypical RatioCompress (MB/s)Decompress (MB/s)Est. OutputEst. Saved
gzip (level 6)5.0:150250200.0 MB
80%
zstd (level 3)5.5:14001,200181.8 MB
82%
zstd (level 19)7.0:1151,200142.9 MB
86%
LZ42.5:17804,000400.0 MB
60%
Snappy2.2:15001,500454.6 MB
55%
Brotli (level 6)6.5:130400153.9 MB
85%
xz / LZMA7.5:18150133.3 MB
87%

Typical Compression by Data Type

Data TypeTypical RatioSpace SavedBest Algorithm
JSON / XML5–10×80–90%zstd / Brotli
Plain Text / Logs4–8×75–87%zstd / gzip
CSV / TSV5–8×80–87%zstd
Database Dumps3–6×67–83%zstd / xz
Compiled Binaries2–3×50–67%zstd / LZ4
JPEG / PNG (already compressed)1.0–1.1×0–10%Do not compress
Video (H.264/H.265)1.0–1.05×0–5%Do not compress

Storage Cost Projection

VolumeUncompressed Cost/moCompressed Cost/moMonthly SavingsAnnual Savings
100 GB$2.30$0.46$1.84$22.08
500 GB$11.50$2.30$9.20$110.40
1,000 GB$23.00$4.60$18.40$220.80
5,000 GB$115.00$23.00$92.00$1,104.00
10,000 GB$230.00$46.00$184.00$2,208.00
Planning notes, formulas, and examples

About the Compression Ratio Calculator

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.

When This Page Helps

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.

How to Use the Inputs

  1. Enter the uncompressed (original) data size.
  2. Enter the compressed data size in the same units.
  3. Review the compression ratio (e.g., 5:1).
  4. Check the space savings percentage.
  5. Compare ratios across different algorithms or data types.
  6. Use the results for storage and bandwidth planning.
Formula used
ratio = uncompressed_size / compressed_size; space_saved_pct = (1 − 1 / ratio) × 100 = (1 − compressed / uncompressed) × 100

Example Calculation

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.

Tips & Best Practices

  • Text data (logs, JSON, CSV) compresses 4–8×. Binary data compresses 1.5–3×. Already-compressed data barely compresses.
  • zstd offers the best ratio-to-speed tradeoff for most workloads. LZ4 is fastest but lower ratio.
  • Brotli provides excellent ratios for web content but is slower to compress than gzip.
  • Higher compression levels increase ratio but decrease speed—level 3–6 is a good default for zstd.
  • Test compression on representative sample data before committing to an algorithm.
  • Streaming compression adds minimal latency; batch compression can be done offline.

Algorithm Comparison

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.

Cost Savings from Compression

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.

Compression in Databases

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.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • 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.