Estimate the final size of a Docker image from its base image and added layers.
A Docker image's final size is the base image plus every unique layer added by RUN, COPY and ADD instructions. Multi-stage builds let you compile or build in one stage (pulling in compilers and dev dependencies) and copy only the final artifacts into a clean final stage, discarding everything else. This calculator estimates the final size both with and without that optimization by applying the fraction of layer weight assumed to be intermediate-only.
finalSize = baseImage + (layers × avgLayerSize) × (1 - multiStage × intermediateFraction)
Docker's union filesystem is layer-based and additive — deleting a file in a later layer just adds a 'tombstone' marker; the original bytes remain in the earlier layer and still count toward image size. Multi-stage builds avoid this by never including those layers in the final image.
For compiled languages (Go, Rust, Java) it's common for 70-90% of build-stage weight (compilers, SDKs, caches) to be discardable. For interpreted languages with many dev dependencies, 40-60% is typical.
Both matter — base image choice (e.g. alpine vs. full Debian) sets your floor, while multi-stage builds control how much of your build toolchain leaks into the shipped image.
Run `docker images` or `docker image inspect` after building, and use `docker history <image>` to see the size contribution of each layer.