Courses / Focus Stacking / Calculator

Focus Stacking Calculator

How many frames do you need, and where should each one be focused? Enter your lens, aperture and the depth you want sharp. The calculator works out the depth of field of every frame, overlaps them, and gives you a shooting list, for macro on a rail and for landscapes from your feet to the horizon.

1 = life size (1:1). 0.5 = 1:2.
As set on the lens.
Front to back of what must be sharp.
20–30% is safe.
—
—DoF per frame
—Rail step
—Effective aperture
FrameRail positionSharp fromSharp to

Two worked examples

Macro

A flower stamen at life size

  • Full frame, 100mm macro lens at 1:1 (1×)
  • f/5.6 on the lens, subject 10mm deep
  • 20% overlap

At 1:1 the light has to travel twice as far to the sensor, so f/5.6 behaves like f/11 for exposure and diffraction. Each frame is only about 0.67mm deep, so the rail moves about 0.54mm between shots.

≈ 20 frames, 0.54mm apart

Stopping down to f/16 would cut the count to about 8, but the effective aperture becomes f/32 and the whole image goes soft from diffraction. More frames at a sharper aperture always wins in macro.

Landscape

Lava rock at your feet, horizon behind

  • Full frame, 24mm at f/11
  • Nearest rock 25cm from the lens, sharp to infinity
  • 20% overlap

The hyperfocal distance is about 1.8m, so one frame focused there is only sharp from about 0.9m. Five frames cover it: focus at roughly 29cm, 39cm, 61cm and 1.5m, then a last frame at the hyperfocal distance, which carries sharpness out to infinity.

5 frames

Notice how the focus points bunch up near the camera: four of the five frames cover the first 1.5 meters. Depth of field grows quickly with distance, so the near foreground takes most of the frames, and the far distance needs just one.

How it works

Macro. Close up, depth of field depends on magnification, not distance: total DoF ≈ 2 × N × c × (m + 1) ÷ m², where N is the f-number, c the circle of confusion and m the magnification. The frame count is the subject depth divided by the DoF minus your overlap, plus one so the back of the subject is covered. Move the camera on a rail by the step shown, or use your camera's focus-bracketing mode with an equivalent step.

Landscape. For each frame the calculator finds the focus distance whose near limit of sharpness sits on the previous frame's far limit (less your overlap), using the standard thin-lens near/far formulas. It repeats until the far limit reaches your farthest point, or infinity once a frame is focused at or beyond the hyperfocal distance.

Overlap. Stacking software needs every part of the subject to be crisp in at least one frame. A 20–30% overlap covers small focusing errors, lens breathing and the fact that "acceptably sharp" at the edge of the DoF isn't the same as critically sharp.

Circle of confusion. The presets use common values (0.030mm for full frame). For high-resolution sensors such as a 60MP body, or for big prints, choose "Custom" and try a smaller value like 0.020mm. You'll need more frames, but each one will hold up at 100%.

Distances here are measured from the lens. Your lens's distance scale measures from the sensor plane, which makes a small difference only at very close range.

New to stacking? Start with the focus stacking course. Shooting a Leica Q3 or SL3? Read focus stacking with the Q3 and SL3.