Formula & Calculator

Compression Ratio

The compression ratio tells you how much a compression algorithm shrinks a file. It is the original size divided by the compressed size. For example, a 10 MB file compressed to 2 MB has a ratio of 5:1, meaning it is five times smaller. Text and some images compress well; already-compressed video and encrypted data do not. It is a key metric in file storage, backup systems, and streaming services, where bandwidth and disk space matter.

Computer Science Data Structures Daily Life
VORZEP · DATA & STORAGE TOOLS

Compression Ratio Calculator

Compute the compression ratio, space saving, and compression factor from any two of the three quantities. Supports both lossless and lossy workflows, with reference values from real codecs and file formats.

CR = Original / Compressed · saved = (1 − 1/CR) × 100% · factor = CR : 1
Solve for
Original Size (O) Size of the uncompressed input — the raw data before any codec is applied. This is the "true" information content as it exists on disk or in memory. The unit is whatever the unit selector shows.
MB
original = 100 MB
Compressed Size (C) Size of the data after compression — what actually gets stored or transmitted. For lossless codecs this is an exact reconstruction of the input; for lossy codecs it is the closest match within the quality setting. Same units as Original Size.
MB
compressed = 20 MB
Compression Ratio (CR) The ratio of original size to compressed size. CR = 5 means the data got 5× smaller. CR < 1 means the "compressed" version is actually larger than the input — which happens when you try to compress already-compressed data (e.g., zipping a JPEG). Ratio is unit-independent.
: 1
CR = 5 → 5:1 → 80.00% space saved
Display Unit The unit in which both sizes are expressed. The ratio is unitless and unaffected. Typical: KB for small files, MB for images and audio, GB for video and archives.
Solve for CR — enter original and compressed sizes.
COMPRESSION RATIO (CR)
5.00 : 1
O = 100 MB · C = 20 MB · saved = 80.00%
GOOD COMPRESSION — ZIP / GZIP CLASS
CR = O / C = 100 / 20 = 5.00
Step-by-step solution
Original vs. Compressed
Original size Compressed size Saved space
Space saved vs. compression ratio
Saved % = (1 − 1/CR) × 100 Current CR
Sensitivity
Companion metrics
Compression visual — size reduction
Original data Compressed data Space saved Expansion (CR < 1)
What the compression ratio really measures
Ooriginal size
÷
Ccompressed size
=
CRcompression ratio

Lossless vs. lossy compression

Lossless codecs (ZIP, gzip, PNG, FLAC) reconstruct the original data bit-for-bit. Their ratios are limited by the data's inherent redundancy — typically 2–5× on text, 1.5–3× on source code, 2–3× on binaries. Lossy codecs (JPEG, MP3, H.264) throw away information the human eye or ear cannot perceive, achieving ratios of 10–100× at the cost of perfect reconstruction. The same calculator handles both — the ratio is just a number.

Compressing already-compressed data fails

ZIP a JPEG and the "compressed" file will typically be larger than the original — CR < 1. High-entropy data (encrypted files, already-compressed video, random bytes) has no exploitable redundancy, so the codec's framing overhead adds bytes instead of removing them. This is why you should never zip a zip file, and why PNG is a poor choice for photographic images (the underlying data is already high-entropy).

Ratio is meaningless without quality

A lossless ratio of 3× and a lossy ratio of 30× are not comparable — the lossy one discarded information to get there. When comparing codecs, always ask "at what quality?". JPEG can hit a ratio of 50× at quality 30 with visible artifacts, or 8× at quality 95 with no perceptible loss. The published "10× compression" for MP3 is meaningless without knowing the bitrate. Our calculator gives the pure ratio; the codec and quality settings are the context.

Theoretical limits — Shannon entropy

No lossless algorithm can compress below the Shannon entropy of the source. For a truly random file, that limit is exactly 1× — you cannot compress it at all. For English text the entropy is about 1.5 bits per character vs. 8 bits stored, so the theoretical maximum ratio is roughly 5×. Real-world gzip achieves 2–3× on English text; PPM and modern context-mixing compressors get closer to 4×. The gap between theoretical and practical is the room left for better algorithms.

How to Use This Calculator

Pick what you want to solve for, then enter the other two quantities. The calculator keeps everything in sync via CR = Original / Compressed.

1. Choose what to solve for

Ratio (CR), compressed size, or original size. The field being solved becomes read-only and shows the computed value; the other two stay editable.

2. Enter values or drag sliders

Type any number or drag the slider. Both work — the calculator updates on every input. Values are in the currently selected unit.

3. Pick the display unit

B, KB, MB, GB, or TB. The ratio is unitless and unaffected; the unit only changes how the two sizes are labelled and displayed.

4. Read the result and verdict

The result card shows the solved value plus a quality badge, from "expansion" (CR < 1, bad) through "modest", "good" (ZIP-class), "high" (JPEG-class), "very high" (video-class), and "extreme" (raw video).

5. Check the visual comparison

The bar chart shows original and compressed sizes side by side, with the saved space marked. In Advanced mode you also get a chart of saved percentage vs. ratio, showing the diminishing returns as CR grows.

6. Switch to Advanced for depth

Advanced mode adds the saved-percentage chart, a sensitivity check, and companion metrics including compression factor, uncompressed bits per compressed byte, and entropy-equivalent checks.

What This Tool Offers

Built around the definition CR = Original / Compressed — the standard measure of how much a codec reduced the input.

Three-way solving

Solve for ratio, compressed size, or original size. The calculator rearranges the formula based on whichever you pick.

Unit selection

Express both sizes in B, KB, MB, GB, or TB. The ratio itself is unitless and never changes with the unit selection.

Compression-quality verdict

Classifies the ratio from "expansion" through "modest", "good", "high", "very high", and "extreme", with reference to real codec families.

Visual size comparison

A bar chart of original vs. compressed sizes with the saved space highlighted, plus an Advanced chart of saved percentage vs. ratio.

Companion metrics

Compression factor, space saved percentage, uncompressed bits per compressed byte, ratio of remaining data, and comparison to common codec benchmarks.

Reference tables

Typical ratios for common codecs and formats, a saved-percentage lookup for common ratios, and a full variable reference.

Reference Tables & Conversions

A saved-percentage lookup for common ratios, typical ratios for real codecs, and a full variable reference.

Ratio ↔ saved % lookup

: 1
%
ratio
CR = 5:1 → saved 80.00% → compressed = 20.00% of original

Typical Compression Ratios by Format

Representative ratios for common codecs. Lossy ratios are for "visually or audibly transparent" settings; higher ratios are achievable at the cost of quality.

Format / CodecTypeTypical CRSpace savedNotes
gzip (text)Lossless2 – 4×50 – 75%General-purpose; fast; the default for HTTP transfer
bzip2 (text)Lossless3 – 5×67 – 80%Slower than gzip but stronger compression
xz / LZMALossless4 – 8×75 – 87%Very strong; used for software distribution
Zstandard (zstd)Lossless2 – 6×50 – 83%Adjustable speed/ratio trade-off; used by Facebook
ZIP (mixed files)Lossless2 – 4×50 – 75%Depends heavily on content; already-compressed files barely shrink
PNG (images)Lossless2 – 3×50 – 67%Good for screenshots and graphics; poor for photos
FLAC (audio)Lossless1.5 – 2×33 – 50%Perfect reconstruction of CD-quality audio
JPEG (photographs)Lossy8 – 20×87 – 95%Quality-dependent; typical q=85 gives ~10×
MP3 (audio)Lossy8 – 12×87 – 92%320 kbps MP3 vs. 1411 kbps CD audio → 4.4×; lower bitrates go much further
Opus (audio)Lossy10 – 20×90 – 95%Better than MP3 at the same bitrate
WebP (images)Lossy/Lossless8 – 30×87 – 97%25–35% smaller than JPEG at the same quality
H.264 / MP4 (video)Lossy50 – 200×98 – 99.5%Compared to raw uncompressed video frames
H.265 / HEVC (video)Lossy100 – 400×99 – 99.75%Roughly 50% better than H.264 at the same quality
AV1 (video)Lossy120 – 500×99.2 – 99.8%Royalty-free successor to HEVC; best current ratio
Encrypted / random data—< 1×NegativeCompression makes it larger due to framing overhead

Space Saved by Ratio

Quick lookup table: saved % = (1 − 1/CR) × 100.

Compression RatioSpace SavedCompressed Size (fraction of original)Typical use
1 : 10.00%100%No compression
1.5 : 133.33%66.67%FLAC audio
2 : 150.00%50.00%PNG, light gzip
3 : 166.67%33.33%gzip on text
5 : 180.00%20.00%Strong gzip, light JPEG
10 : 190.00%10.00%JPEG q=85, MP3 128 kbps
20 : 195.00%5.00%JPEG q=60, high-quality MP3
50 : 198.00%2.00%Low-bitrate video
100 : 199.00%1.00%Standard H.264 video
200 : 199.50%0.50%High-efficiency HEVC / AV1
1,000 : 199.90%0.10%Very aggressive video compression

Variable Reference

SymbolMeaningTypical rangeFormula
OOriginal (uncompressed) size> 0input
CCompressed size> 0input
CRCompression ratio0.5 – 1000O / C
savedSpace saved percentage−100% – 99.9%(1 − 1/CR) × 100
factorCompression factor (X : 1)0.5 : 1 – 1000 : 1CR : 1
bits/byteUncompressed bits per compressed byte0 – 88 / CR

What Does the Compression Ratio Measure?

The compression ratio quantifies how much a codec reduced the size of its input. It is the single most common metric for comparing compression algorithms and settings: gzip achieves 3× on English text, JPEG achieves 10× at visually transparent settings, H.264 achieves 100× on video compared to raw frames. Ratio alone does not tell the whole story — you also need to know whether the compression was lossless or lossy, and at what quality setting — but it is the starting point for every discussion of compression performance.

The Compression Ratio Formula

The defining relationship is straightforward:

CR = Original Size / Compressed Size

Rearranging to solve for the other quantities:

Compressed Size = Original Size / CR
Original Size = Compressed Size × CR
Space Saved (%) = (1 − 1/CR) × 100
Compression Factor = CR : 1

A ratio of 5 means the compressed file is one-fifth the size of the original — equivalently, you saved 80% of the space. A ratio of 0.9 means the "compressed" file is actually larger, which happens on already-compressed or high-entropy data.

Compression Ratio Variables

SymbolMeaningNotes
OOriginal sizeRaw input before any compression
CCompressed sizeWhat gets stored or transmitted
CRCompression ratioO / C — dimensionless, unit-independent
savedSpace saved %(1 − 1/CR) × 100
factorRatio notatione.g., "5:1" or "5×"

Lossless vs. Lossy Compression

Every compression algorithm falls into one of two categories, and the ratio means very different things for each. Lossless codecs (ZIP, gzip, PNG, FLAC, Bzip2, LZMA, Zstandard) guarantee that decompressing the output gives back exactly the original bytes. Their ratios are bounded by the source's Shannon entropy — a truly random file cannot be compressed at all, while English text can typically reach 3–5×. Lossy codecs (JPEG, MP3, H.264, Opus, WebP-lossy) discard information that human perception will not miss, achieving ratios that are far higher (10–100×+) but at the cost of a decompressed output that is only an approximation.

The distinction matters because a lossless 3× and a lossy 3× are not comparable achievements. The lossy codec "paid" for its ratio with perceptual quality — if it had been constrained to reconstruct perfectly, it would achieve far less. When you compare two lossy codecs by ratio, you must always ask "at what quality?" — an MP3 at 64 kbps compresses to 22× but sounds terrible; at 320 kbps it compresses to 4.4× and sounds indistinguishable from CD.

Why Compression Fails on Already-Compressed Data

If you try to compress a JPEG with gzip, the "compressed" output will typically be larger than the original — a ratio below 1. The reason is that the JPEG has already had its redundancy removed by the JPEG codec; what remains is close to the entropy limit of the image. gzip can only find patterns that are actually present in the byte stream, and a JPEG's bytes look almost random. The same applies to encrypted files, hash digests, and — famously — the output of any good compression algorithm. This is why layered compression (zip-a-zip) never works, and why well-designed backup tools skip compression on file types that are already compressed.

There is an information-theoretic floor on how small a file can get. Shannon's source coding theorem states that the minimum expected length of a lossless encoding is the source's entropy. For a file containing n bytes of true randomness, that entropy is exactly n × 8 bits — no algorithm can represent it in fewer bits. The corollary is that a codec can only win by exploiting redundancy: statistical patterns, repeated substrings, or structure in the data. When there is no structure, there is no win.

Compression Ratio Calculation Examples

Given: O = 100 MB, C = 20 MB — solve for CR
CR = 100 / 20 = 5.00 : 1
Saved = (1 − 1/5) × 100 = 80.00%
Given: O = 1,000 MB, CR = 10 — solve for compressed size
C = O / CR = 1,000 / 10 = 100 MB
Saved = (1 − 1/10) × 100 = 90.00%
Given: C = 5 MB, CR = 50 — solve for original size
O = C × CR = 5 × 50 = 250 MB
Saved = (1 − 1/50) × 100 = 98.00%
Given: O = 5 MB, C = 6 MB (compressing a JPEG with gzip)
CR = 5 / 6 = 0.833 : 1
Saved = (1 − 1/0.833) × 100 = −20.00% (expansion!)

Frequently Asked Questions

It depends entirely on the data type and whether lossy compression is acceptable. For lossless compression of English text, 3–4× is very good (PPM, LZMA). For source code, 4–6× is achievable. For binaries and executables, 2–3× is typical. For photographic images, lossless PNG gets 1.5–2.5×, but lossy JPEG at visually transparent settings gets 8–15×. For video, 100× or more is standard. There is no single "good" number — the right question is "compared to what alternative?" For a given codec and data type, comparing against typical published ratios tells you if your results are expected or anomalous.

Because the input was already compressed or had no exploitable redundancy. When you ZIP a JPEG, MP3, MP4, or encrypted file, the codec finds no patterns it can exploit and has to add its own framing overhead (headers, checksums, metadata), making the result larger. This is exactly what a compression ratio below 1.0 represents. The general rule: only compress data that has not been compressed before. If you are not sure, try it — but be prepared for the output to be slightly larger than the input on high-entropy files.

No. The compression ratio is unitless, because it is a ratio of two quantities in the same unit. If you halve a 100 MB file down to 50 MB, the ratio is 2. If you express the same file as 100,000 KB and 50,000 KB, the ratio is still 2. If you express it as 104,857,600 bytes and 52,428,800 bytes, still 2. This is why the unit selector only changes the display labels — the ratio is invariant. The space-saved percentage is also unit-independent.

Yes, unambiguously — but only if both actually deliver 10:1 on the same input. In practice, a lossless codec cannot usually reach 10:1 on real-world data (its ratio is bounded by the source entropy). A lossy codec that achieves 10:1 has discarded information to get there. So the comparison "10:1 lossless vs. 10:1 lossy" is almost never a fair fight — the lossless ratio simply won't reach that number on most inputs. When it does — say, on highly redundant data like a bitmap of a solid color — it is strictly better, because the reconstruction is exact and cannot be improved upon.

They mean the same thing, just written differently. A "compression factor of 5" and a "compression ratio of 5:1" both mean the compressed output is one-fifth the size of the input. "Ratio" is typically written as a fraction with a colon (5:1) while "factor" is written as a single number or with a multiplication sign (5× or "5-fold"). The two are interchangeable. Our calculator uses "ratio" for the primary value and shows the factor form alongside it.

Space saved = (1 − 1/CR) × 100%. For CR = 2, saved = (1 − 0.5) × 100 = 50%. For CR = 5, saved = (1 − 0.2) × 100 = 80%. For CR = 10, saved = (1 − 0.1) × 100 = 90%. As the ratio grows, saved percentage approaches 100% asymptotically — CR = 100 gives 99% saved, CR = 1,000 gives 99.9%. This is why doubling the ratio from 10 to 20 does not double the perceived improvement: it goes from 90% saved to 95%, only 5 percentage points better. The "space saved" metric flattens out quickly, which is why engineers usually compare ratios directly.

Yes — compressed size = original size / ratio. This is one of the three solve directions the calculator supports: switch the "Solve for" toggle to "Compressed size", enter the original size and ratio, and the compressed size is computed. Similarly, switch to "Original size" and enter the compressed size and ratio to get the original. All three permutations are supported and stay in sync as you edit any field.

Calculating...

Variables

Symbol Quantity Unit
Ratio Compression ratio
Original Size Size before compression bytes
Compressed Size Size after compression bytes

What it means

The compression ratio measures the effectiveness of a data compression algorithm. It is defined as the size of the original data divided by the size of the compressed data. A ratio of 2:1 means the compressed data is half the original size. Higher ratios indicate better compression, but they depend on the data type and the algorithm (lossy vs. lossless). For example, text files often achieve ratios of 3:1 to 5:1, while images can be compressed much more (e.g., JPEG). The ratio is used to compare compression methods and to estimate storage savings. However, it is not the only metric; compression speed, memory usage, and quality (for lossy) are also important. In practice, compression ratios are often expressed as percentages (e.g., 25% of original size). Understanding the ratio helps in choosing the right compression for given data, balancing bandwidth and storage costs. It is also used in networking to assess the impact of compression on transmission time.

Worked example

Compression Ratio – Two Examples

Real‑World
Scenario 1 – Image Compression: A 10 MB raw image is compressed to 2 MB. What is the compression ratio?
ParameterValue
Original size10 MB
Compressed size2 MB
1Ratio = Original / Compressed = 10/2 = 5
Result 5:1 ✓ Good compression
Scenario 2 – Text Compression: A 1 MB text file is compressed to 200 KB. What is the ratio?
ParameterValue
Original size1 MB = 1024 KB
Compressed size200 KB
1Ratio = 1024 / 200 = 5.12
Result ≈ 5.1:1 ✓ Good for text
Key insight: Compression ratio measures space savings – higher is better. Text compresses better than images or already‑compressed data.

Common mistakes

  • Original vs. compressed size: Put original size in the numerator, compressed in the denominator.
  • Ratio notation: Often expressed as “original:compressed” (e.g., 4:1).
  • Lossy vs. lossless: Compression ratio for lossy (e.g., JPEG) may not reflect quality degradation.
  • Size units: Both sizes must be in the same unit (e.g., bytes, KB).
  • Reversibility: A high compression ratio may indicate a lossy algorithm if the original cannot be exactly reconstructed.

Applications

Compression ratio is the ratio of the original file size to the compressed file size, indicating how much data reduction has been achieved. It is a key metric in data storage, transmission, and archiving. Engineers use compression ratio to evaluate different compression algorithms (e.g., ZIP, JPEG, MP3), to select appropriate settings for a given dataset, and to balance quality against size. In web development, it influences page load times and bandwidth usage. In multimedia, it affects storage requirements and streaming quality. Understanding compression ratio helps in optimising storage costs, in reducing network traffic, and in designing efficient file formats.

  • Evaluation of compression algorithms and settings
  • File archiving and backup optimisation
  • Web performance optimisation (image, text compression)
  • Multimedia encoding (audio, video, images)
  • Storage cost reduction and bandwidth saving

Related calculators · Data Encoding & Conversion

Suggest an improvement

Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.

Page details

1,837

Views
  • Published July 11, 2026
  • Last updated October 9, 2026