Docker Image Compression Calculator
Estimate compressed vs uncompressed image size savings across registry transfers.
Inputs
Total uncompressed size (as seen by `docker images`).
Typical gzip compression ratio (2–4× for most images).
Number of layers in the image.
Compressed Image Size
320.0MB
Compression Savings
60.0%
Size Saved
480.0MB
Avg Compressed Layer
32.0MB
Step by step
Compressed size
800MB / 2.5
= 320.0MB
Savings
800MB − 320.0MB
= 480.0MB (60.0%)
Average compressed layer
320.0MB / 10
= 32.0MB
How it works
Docker layers are stored compressed (gzip) in registries. Compressed size = uncompressed / compressionRatio. Typical ratios: 2–3× for compiled binaries, 3–5× for text-heavy layers (node_modules, documentation), 1.2–1.5× for already-compressed data.
Formula
Compressed Size
compressed = uncompressed / compressionRatio
- uncompressed
- Uncompressed image size in MB
- compressionRatio
- Gzip compression ratio (typically 2–4)
Frequently Asked Questions
Why does `docker images` show a different size than the registry?
`docker images` shows uncompressed size (what's on disk locally); the registry stores gzip-compressed layers, so registry storage and transfer sizes are significantly smaller.
Can I improve the compression ratio?
Reducing entropy in layers helps — combining related files, removing unnecessary files before layer commit, and avoiding random/binary content that doesn't compress well.