Compression Ratio Calculator
Compression squeezes data into less space, and the compression ratio is the standard way to describe how much it shrank. This calculator takes the original size and the compressed size and divides the first by the second to give the ratio. A 1,000 byte file that compresses to 250 bytes has a ratio of 4, written 4:1, meaning the compressed copy is one quarter the size of the original. Alongside the ratio the page reports the space saved as a percentage, which for a 4:1 ratio is 75 percent, because three quarters of the bytes are gone. The two views answer different questions: the ratio is best for comparing algorithms, while the percentage is intuitive for storage planning. What counts as a good ratio depends entirely on the data. Text, logs and databases hold a lot of redundancy and often compress several times over, while already-compressed media such as JPEG, MP3 or ZIP barely shrink because their redundancy is gone. The measure applies to both lossless and lossy methods, since it only compares sizes. Every figure is computed deterministically from your two inputs, never estimated, with the method and a worked example shown below for verification.
Compression ratio is the original size divided by the compressed size: ratio = original / compressed. A 1,000 byte file compressed to 250 bytes has a ratio of 4.00:1, saving 75% of the space.
Compression ratio formula
ratio = original size / compressed size
space saved = (1 - compressed / original) x 100%
compressed fraction = compressed / original
higher ratio means more shrinkage
The ratio compares the two sizes directly. The space saved restates the same relationship as a percentage, which is more intuitive for storage planning.
Worked example
A 1,000 byte file is compressed down to 250 bytes.
- Ratio = 1,000 / 250 = 4, written 4:1
- Compressed fraction = 250 / 1,000 = 0.25
- Space saved = (1 - 0.25) x 100% = 75%
The ratio is 4.00:1 and 75 percent of the space is saved. These are the calculator's default inputs, so the result above matches the widget exactly.
Ratio and space saved
The two views describe the same shrinkage.
| Ratio | Space saved |
|---|---|
| 2:1 | 50% |
| 4:1 | 75% |
| 5:1 | 80% |
| 10:1 | 90% |
Data representation and compression concepts: US National Institute of Standards and Technology (NIST).
Compression ratio calculator: frequently asked questions
How do you calculate a compression ratio?
Divide the original size by the compressed size. If a 1,000 byte file compresses to 250 bytes, the ratio is 1,000 divided by 250, which is 4, written 4:1. A higher ratio means more shrinkage.
What is the space saved percentage?
Space saved is one minus the compressed size divided by the original size, expressed as a percentage. For a 4:1 ratio the compressed file is one quarter of the original, so the space saved is 75 percent.
What is a good compression ratio?
It depends entirely on the data. Plain text and logs often compress 3:1 to 10:1, while already-compressed formats like JPEG, MP3 or ZIP compress very little because their redundancy has already been removed. There is no universal target.
Is this lossless or lossy compression?
The ratio is just the size relationship and applies to both. Lossless compression reproduces the original exactly, while lossy compression discards detail to reach a higher ratio. The calculator measures the sizes regardless of which method produced them.
Is the result computed automatically?
Yes. The page divides the two sizes deterministically and computes the space saved. No value is estimated or hard-coded, so changing either size updates the ratio instantly.
Official sources
- Data representation and compression concepts: US National Institute of Standards and Technology (NIST). As at 25 June 2026.
Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.