Perrin Adams
Free tool · Macro photography

Focus Stacking Calculator

How much of your subject does one frame keep sharp, how many frames do you need, and how far do you move between them? Set your camera below and watch the stack build.

Camera sensor
Magnification
1×1:1 life size
Aperture
f/8
Your camera shows

Not sure? Focus your macro lens as close as it goes. If the f-number climbs on its own, your camera shows effective aperture.

mm, front to back
Sharpness standard
Advanced
Frame overlap25%

How much each frame's sharp zone overlaps the next. 20–30% is a common rule of thumb to avoid soft bands between slices.

exit ÷ entrance pupil

Leave at 1 unless you know your lens's value. It depends on the lens design and changes with focus distance.

Side view of a fly divided into focus slices
Frame 1 of 8
Depth of field per frame–Total, in front of and behind focus
Frames to stack–
Step between frames–
Effective aperture–
Diffraction

Using in-camera focus bracketing? Step-width settings aren't in millimetres, differ by brand, and on many cameras change with the aperture. Use the frame count as a starting point, choose a small step width, and set the shot count a little higher than shown so the stack doesn't stop short.

An iridescent green bottle fly on a rough stone surface, its large red eyes in sharp focus.
Fly on the WallSee the Macro gallery

How the calculator works

At macro distances, depth of field gets tiny. At life size (1:1) and f/8 on a full-frame camera, only about a millimetre of your subject is sharp, and most insects are several millimetres deep. Focus stacking solves it: you shoot a series of frames, moving focus a little each time, then blend the sharp parts together in software.

The calculator uses the standard close-up depth of field formula:

Depth of field ≈ 2 × N × c × (1 + m ÷ P) ÷ m²
  • N is the aperture you set on the lens.
  • c is the circle of confusion, the largest blur that still looks sharp. The calculator uses the standard values for each sensor size, such as 0.03 mm for full frame. "Critical" halves it for large prints and close inspection.
  • m is magnification. 1× means the subject is life size on the sensor.
  • P is pupil magnification, a property of the lens design. Telephoto-style lenses are usually below 1 and wide-angle designs above 1. If you don't know it, 1 is the usual assumption.

Frames to stack are worked out from your subject's depth. Each frame moves forward by its depth of field minus the overlap you choose, so the sharp zones always overlap a little. This close-up formula is accurate to within a few percent across the calculator's range (0.1× and up).

Does the lens matter?

Less than most people expect. At the same magnification and aperture, a 60 mm and a 100 mm macro lens give you essentially the same depth of field; any small difference comes from pupil magnification. The longer lens gives you more working distance and a narrower background, but no extra depth.

The lens matters in three ways: its pupil magnification (in the Advanced settings), how your camera reports the aperture, and how you reach your magnification. With extension tubes, the magnification you gain depends on the focal length, which on many macro lenses gets shorter as they focus closer. "Lens + tubes" gives a quick estimate; "Measure it" gives the real number.

Set aperture vs effective aperture

As you focus closer, less light reaches the sensor and the lens behaves as if it were stopped down. At 1:1, f/8 acts like about f/16. That effective aperture controls both exposure and diffraction. Nikon cameras, for example, display the effective number with Nikon macro lenses, while many other cameras show the aperture you set. Choose the matching option so the maths isn't counted twice.

Diffraction

Stopping down gives you more depth per frame, but past a point diffraction softens everything. The calculator compares the size of the diffraction blur at your effective aperture with your sharpness standard and shows the diffraction limit: the highest f-number before that blur grows larger than the standard. Diffraction builds gradually, so treat the levels as a guide. For the crispest stacks, work a stop or two wider than the limit and shoot more frames.

Focus rail or in-camera bracketing?

On a focus rail you move the camera itself, so the step size above is exactly how far to move between frames. In-camera focus bracketing moves the focus instead. It's faster and great for the field, but the step-width numbers are relative settings that differ by brand, and many cameras adjust them for the aperture. Use the frame count as a guide and add a few frames to be safe.

Tips from the field

  • Cool mornings are your friend: insects sit still until the sun warms them up, and the air is usually calm.
  • Start at the nearest point and work back. That's also the default direction for in-camera focus bracketing on most cameras.
  • Soft, even light keeps every frame matched. A diffused flash or a cloudy sky beats harsh sun.
  • Blend in Helicon Focus, Zerene Stacker or Photoshop, then retouch any halos by hand.

Results are estimates from standard optical formulas. Real lenses vary a little, so treat the numbers as a starting point and check your first stack at 100%.

Like what you see?

Prints and licensing are available for all my macro work.