The arithmetic, stated
lens, left one frame's depth of field, three frames subjectstep ≤ DoF × 0.7
Hyperfocal distance H = f² ⁄ (N·c) + f, where f is the focal length, N the f-number and c the circle of confusion for the sensor. For a focus distance s, the near limit is s(H − f) ⁄ (H + s − 2f) and the far limit s(H − f) ⁄ (H − s), infinite once s reaches H. In macro mode, where you know the magnification m rather than the distance, the depth of field is 2·N·c·(1 + m) ⁄ m², which already contains the effective-aperture growth.
The stacking step is one frame's depth of field times (1 − overlap), and the frame count is the subject depth divided by the step, plus one, so the first and last frames sit beyond the subject. Most depth-of-field calculators stop at the first paragraph; the second is why this one exists.
Which circle of confusion?
The values here are the conventional ones for a print viewed at normal distance. If you inspect at 100 % on a 45-megapixel sensor, halve them — and expect the frame count to double. The calculator is a planning tool; the stacker's inspector is the judge.
Worked examples: how many frames a 12 mm subject needs
Every row is computed by the same code as the calculator above, for a full-frame sensor (circle of confusion 0.030 mm), a subject 12 mm deep — a large insect, a watch movement, a coin on its edge — and 30 % overlap between neighbouring slices. Magnification is the reproduction ratio: 1× is life size, 0.5× half life size.
| Magnification | Aperture | Depth of field per frame | Focus step | Frames |
|---|---|---|---|---|
| 0.5× | f/8 | 2.88 mm | 2.02 mm | 7 |
| 1× | f/5.6 | 0.67 mm | 0.47 mm | 27 |
| 1× | f/8 | 0.96 mm | 0.67 mm | 19 |
| 1× | f/11 | 1.32 mm | 0.92 mm | 14 |
| 2× | f/5.6 | 0.25 mm | 0.18 mm | 70 |
| 5× | f/4 | 0.06 mm | 0.04 mm | 299 |
Magnification costs far more than aperture. Going from 1× to 2× at f/5.6 shrinks each frame's depth of field from 0.67 mm to 0.25 mm and the series from 27 to 70 frames, while stopping down from f/5.6 to f/11 at 1× only takes the count from 27 to 14. Stopping down is not free either: at life size the effective aperture is twice the marked one (f/8 behaves like f/16), and diffraction softens every frame on a high-resolution sensor. That is why macro stackers usually shoot around f/5.6–f/8 and accept more frames.
At ordinary distances the numbers relax. With the calculator's defaults — a 100 mm lens at f/8 focused at 50 cm on full frame — one frame holds about 9.60 mm of depth, so the same 12 mm subject needs 3 frames. Product and tabletop shots sit here; insects and minerals sit in the table.