ToolJoltTools

Conv2D Output Size Calculator

Output H×W of a 2-D convolution from input size, kernel, stride, padding and dilation — with the floor-division gotcha.

Output width (px)
Output height (px)
Spatial reduction (×)

Defaults are ResNet's stem: 224×224 input, 7×7 kernel, stride 2, padding 3 → 112×112. The floor division silently drops pixels when (in+2p−k) isn't divisible by the stride — the classic off-by-one debugging trap.

Formula

out = ⌊(in + 2·padding − dilation·(kernel−1) − 1) / stride⌋ + 1
References: Dumoulin & Visin (2016), A Guide to Convolution Arithmetic for Deep Learning; PyTorch nn.Conv2d documentation

About Conv2D Output Size Calculator

Every CNN debugging session eventually arrives at the same question: what size does this conv layer output? This calculator implements the exact PyTorch/TensorFlow formula — including dilation and the floor division that silently swallows edge pixels when shapes don't divide evenly. Defaults show ResNet's famous 7×7-stride-2 stem turning 224×224 into 112×112. Chain it mentally (or with our receptive-field tool) through your network to find where a shape mismatch is born instead of reading framework stack traces backwards.

How to use Conv2D Output Size Calculator

  1. 1Enter your values into Conv2D Output Size Calculator — sensible, domain-typical defaults are pre-filled so you see a real result immediately.
  2. 2The result recomputes live using the formula shown on the page; there is no button to press.
  3. 3Adjust any input to compare scenarios, then read the worked example to see the substituted numbers.

Why use Conv2D Output Size Calculator?

  • Computes Conv2D Output Size instantly in your browser — no sign-up, no upload, no server round-trip.
  • 100% free and unlimited, with the exact formula shown: out = ⌊(in + 2.
  • Runs entirely client-side, so every value you enter stays private on your device.
  • Live recompute as you type, with a worked example and authoritative references for trust.

Frequently asked questions

Why did my output shrink by one pixel from what I expected?+

Floor division. If (input + 2·padding − kernel) is not an exact multiple of stride, the formula floors, discarding the leftover rows/columns at the bottom-right. TensorFlow's 'SAME' mode pads asymmetrically to avoid this; PyTorch makes you pick padding yourself.

What padding keeps the size unchanged ('same' convolution)?+

For stride 1 and odd kernel k: padding = (k−1)/2 — so 1 for 3×3, 2 for 5×5, 3 for 7×7. With dilation d: padding = d·(k−1)/2. For even kernels true 'same' needs asymmetric padding, which is why even kernels are rare.

How does dilation change the output size?+

Dilation d spreads the kernel's taps apart, making its effective size d·(k−1)+1: a 3×3 at dilation 2 covers a 5×5 footprint. Output shrinks accordingly unless padding compensates — the formula in this tool handles it exactly.

Does the channel count affect output H×W?+

No — channels are orthogonal to spatial geometry. Output channels equal the number of filters you choose; only kernel, stride, padding and dilation determine the spatial size. (Channels do drive parameters and FLOPs — see our Conv2D parameter and FLOPs tools.)

Related tools

Related ML & AI tools

Sponsored