Compression Ratio Calculator

Enter the original and compressed file sizes to compute the compression ratio (X:1 form) and percentage of space saved.

Everyday X:1 ratio Space savings % B / KB / MB / GB
Rate this calculator · 5.0 (1)

Compression Ratio Calculator

Enter both sizes. Ratio and savings update live.

Instructions — Compression Ratio Calculator

  1. Pick a unit for file sizes (bytes, KB, MB, or GB). Both inputs use the same unit.
  2. Enter the original size of your file before compression.
  3. Enter the compressed size after running your codec or archiver.
  4. The headline displays the compression ratio in standard X:1 form. The stat grid shows space saved as a percentage, size reduction, and effective bits per byte.

If the compressed size exceeds the original, the calculator flags it as expansion — this happens with random data or already-compressed files.

Formulas

Compression ratio:

CR = original_size / compressed_size

A result of 5 means 5:1 — the original file is five times larger than the compressed file.

Space savings:

Savings % = (1 − compressed/original) × 100

Relationship:

Savings % = (1 − 1/CR) × 100

A 2:1 ratio equals 50% savings; 4:1 equals 75%; 10:1 equals 90%.

Reference

Lossless: ZIP and gzip (DEFLATE, specified in IETF RFC 1951) typically achieve 2:1 to 3:1 on text and code, 1.0-1.2:1 on already-compressed media. PNG averages 2-3:1 for natural images. FLAC achieves about 1.5-2:1 on CD-quality audio per the FLAC Project specification.

Lossy: JPEG averages around 10:1 at default quality settings (ISO/IEC 10918 standard). MP3 typically yields 10-12:1 versus uncompressed PCM. H.264 (ITU-T H.264 / ISO/IEC 14496-10) often exceeds 50:1 on video at perceptually equivalent quality, and the newer H.265 doubles that.

Article — Compression Ratio Calculator

Compression ratio calculator: file size reduction explained

Compression ratio is the original file size divided by the compressed file size, expressed as X:1. A 100 MB file compressed to 20 MB has a 5:1 ratio, equivalent to 80% space savings. Modern video codecs routinely achieve 50:1 or higher; lossless archivers like ZIP typically land between 2:1 and 3:1.

The math is simple but the implications are wide: storage cost, network transfer time, streaming quality, and battery life on mobile devices all depend on compression ratios. Understanding what a given ratio means — and what it cannot mean — is essential for evaluating codec choices and storage budgets.

What is compression ratio?

Compression ratio is a dimensionless number that measures how much smaller the compressed output is compared to the original input. A ratio of 1:1 means no compression occurred; a ratio of 10:1 means the output is one-tenth the input size.

The IEEE digital signal processing literature uses the same definition consistently. The ratio can be expressed as either a fraction (original/compressed) or as a percent of space saved, and the two are interconvertible: a 4:1 ratio equals 75% space saved, computed as (1 − 1/4) × 100.

Did you know

The DEFLATE algorithm — used inside ZIP, gzip, and PNG — is documented in IETF RFC 1951. It combines LZ77 dictionary coding with Huffman entropy coding, the same two techniques that underpin most general-purpose compressors today.

The compression ratio formula

Three formulas cover almost every question.

  • Compression ratio = original_size / compressed_size
  • Space savings % = (1 − compressed/original) × 100
  • Savings from ratio = (1 − 1/CR) × 100
  • Bits per byte (after compression) = (compressed/original) × 8
  • Inverse: target compressed size = original / desired_ratio
Ratio to savings
2:1 = 50% saved
4:1 = 75% saved
10:1 = 90% saved
50:1 = 98% saved
100:1 = 99% saved

Lossless vs lossy compression

Lossless compression reconstructs the original bytes exactly. The decompressed file is bit-for-bit identical to the input. ZIP, gzip, PNG, and FLAC are all lossless. Typical ratios are 1.5:1 to 3:1 for general data, higher for highly redundant text or sparse images.

Lossy compression deliberately discards information judged perceptually unimportant. JPEG, MP3, H.264, and AAC are all lossy. They achieve much higher ratios — often 10:1 to 100:1 — at the cost of some quality loss that may or may not be visible to humans.

Lossless (ZIP, PNG)
~2-3:1
exact reconstruction
Lossy (H.264)
~50:1+
perceptual quality loss

Typical compression ratios by format

Ratios depend on content, codec settings, and algorithm. Approximate norms:

  • ZIP / gzip (DEFLATE) = 2:1 to 3:1 on text; near 1:1 on already-compressed media
  • PNG (lossless image) = 2:1 to 3:1 on photographs, much higher on flat graphics
  • FLAC (lossless audio) = 1.5:1 to 2:1 on CD-quality PCM
  • JPEG (lossy image) = ~10:1 at default quality; 4:1 high quality; 20:1 aggressive
  • MP3 (lossy audio) = ~11:1 versus uncompressed 16-bit PCM
  • H.264 (lossy video) = 50:1 to 200:1 depending on resolution and quality target
  • H.265 / HEVC = roughly 2× H.264 efficiency for similar perceived quality

Compression ratio vs engine ratio

The phrase "compression ratio" appears in two unrelated contexts. In data compression, it measures file size reduction. In automotive engineering, it measures the volume of an engine cylinder before and after compression of the air-fuel mixture — a mechanical efficiency metric.

A modern naturally aspirated gasoline engine runs at roughly 10:1 to 13:1 mechanical compression. A diesel engine, which relies on compression heat to ignite fuel, runs at 14:1 to 23:1. The numbers look similar to data compression ratios but the physics is completely different.

Do not mix the two ratios

Engine compression ratio describes a physical volume change inside a metal cylinder. Data compression ratio describes a numerical size reduction in a digital file. The math notation is the same; the underlying systems are not comparable.

Why some files cannot be compressed

Shannon's source coding theorem (1948) puts a hard floor on compression: the average compressed length cannot fall below the entropy of the source. Truly random data has maximum entropy and cannot be compressed at all. Already-compressed files (a JPEG, a ZIP, an MP4) are close to maximum entropy from the perspective of a second compressor — running them through gzip a second time typically grows them slightly due to header overhead.

That is also why "re-zipping" a file rarely helps. If the compressor was efficient the first time, the residual redundancy is near zero. Some files actually grow when compressed because of the algorithm's metadata footprint exceeding the few bytes it saves.

Tip

For archives that mix many small text files, ZIP and tar+gzip both work well. For media (already lossy-compressed photos, music, video), use a container format like 7z or tar without recompression — you save metadata but not file size.

Compression ratio mistakes to avoid

Three common errors come up around compression ratio. Comparing different content types — text and video are not comparable, since their underlying entropy differs by orders of magnitude. Ignoring codec settings — a JPEG at quality 95 and a JPEG at quality 50 produce wildly different ratios on the same image. Treating high ratio as automatically better — high lossy ratios mean more quality loss, not necessarily better compression. The right metric is quality per bit, not raw ratio.

A subtler trap is comparing compression ratios produced by tools with different default settings. Two ZIP utilities may report identical filename and metadata but use different DEFLATE compression levels, producing files that differ by 10-15% in size. When benchmarking compressors, always specify the level or setting alongside the ratio — otherwise the comparison is meaningless.

Did you know

Modern operating systems compress filesystem data transparently. APFS on macOS, NTFS compression on Windows, and ZFS on Linux all apply compression in the background. Your visible disk usage is often the compressed footprint, not the raw file size — which is why a quick file size compression ratio check can be a useful sanity check.

One last practical note: compression and encryption interact badly. Encrypted data has near-maximum entropy and resists compression. If you need both, compress first and then encrypt. Compressing already-encrypted data wastes time and produces near-zero space savings, since the entropy is already at the Shannon limit.

FAQ

The original file is five times larger than the compressed file. Equivalently, you saved 80% of the original space. For example, 100 MB compressed to 20 MB is 5:1.
Use the formula: Savings % = (1 − 1/CR) × 100. So 2:1 = 50%, 4:1 = 75%, 10:1 = 90%, and 100:1 = 99%.
This happens when the input is already compressed (JPEG, MP4, ZIP, encrypted data) or essentially random. Compressors add headers and metadata; if there is no redundancy left to exploit, the result grows. The calculator flags this as expansion.
Lossless compression (ZIP, PNG, FLAC) reconstructs the original byte-for-byte; lossy compression (JPEG, MP3, H.264) discards perceptually unimportant data to achieve higher ratios. Use lossless for documents and code, lossy for media where minor quality loss is acceptable.
At default quality settings (typically Q=75-85), JPEG achieves around 10:1 versus uncompressed bitmap. High-quality settings drop to 4-6:1; aggressive settings can push 20:1 or higher with visible artifacts.
Mathematically the ratio operation is similar, but the meaning is different. Automotive engine compression ratio measures the volume of an engine cylinder before and after compression — a mechanical, not a data, metric. The two concepts share a name but are unrelated.
Video has enormous temporal redundancy between frames. H.264 uses motion estimation, transform coding, and inter-frame prediction to encode only what changes. The ITU-T H.264 standard documents these techniques in detail.