Skip to content
ENExplore Calculators

File Compression Ratio Calculator

Calculate compression ratio and space savings between original and compressed file sizes.

About File Compression Ratio Calculator

Compression ratio (original:compressed) and space-saved percentage describe the same result two ways. How much a file actually compresses depends heavily on its entropy: plain text, logs and source code compress very well (~70% smaller) because of high redundancy; generic binaries and database dumps compress moderately (~20%); and already-compressed media formats like JPEG, MP4 and MP3 barely shrink further (~5%) because their encoders already removed most redundancy — recompressing them mostly wastes CPU time.

Formula

Compression ratio and space saved

ratio = original / compressed; space_saved% = (1 − compressed/original) × 100

S_orig
original size
S_comp
compressed size

Worked example

With the default values below, File Compression Ratio Calculator returns Compression Ratio of 3.33:1. Change any input above and every figure here is recalculated in your browser.

Inputs used

Original Size (MB)minimum 0
1,000
Input Modeone of Estimate from content type, I have the compressed size
Estimate from content type
Content Typeone of Text / source code / logs (~70% savings), Generic binary / database dumps (~20% savings), Media (JPEG/MP4/MP3, already compressed, ~5% savings)
Text / source code / logs (~70% savings)
Compressed Size (MB)minimum 0
300

Results

Compression Ratio
3.33:1
Space Saved
70.00%
Compressed Size (MB)
300.00
Space Saved (MB)
700.00

Step by step

  1. 1Values used
  2. 2Compression ratio and space saved
  3. 3Compression Ratio= 3.33:1
  4. 4Space Saved= 70.00
  5. 5Compressed Size (MB)= 300.00
  6. 6Space Saved (MB)= 700.00

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why doesn't gzip shrink my JPEG or MP4 files much?

JPEG, MP4 and MP3 already apply strong lossy/entropy compression internally, so there's little statistical redundancy left for gzip's algorithm to exploit. Compressing an already-compressed file typically saves only a few percent and can occasionally even increase size slightly due to format overhead.

What's a good compression ratio for log files?

Text-heavy logs typically compress 4:1 to 10:1 (70-90% space saved) with gzip, and even better with algorithms like zstd or xz at higher settings, because of repeated timestamps, field names and common message patterns.

Does a higher compression ratio always mean a better choice?

Not necessarily — higher-ratio algorithms (like xz -9) trade significantly more CPU time and memory for modest extra savings over faster options (like gzip or zstd). For frequently-accessed data, a faster algorithm with a slightly lower ratio is often the better overall trade-off.

File Compression Ratio Calculator | Calcrivo