Focus stacking is a technique where you take multiple photographs of the same scene at different focus distances and merge them in software to produce a single image that is sharp from front to back. It overcomes a fundamental limitation of optics: no single exposure can render everything from a few centimeters away to infinity in perfect focus, especially at the close distances used in macro photography or when using wide apertures. Focus stacking solves this by combining the sharpest parts of each frame into one composite.

Why Focus Stacking Matters
Every lens has a limited depth of field, the zone in front of and behind your focus point that appears acceptably sharp. At normal shooting distances, stopping down to f/11 or f/16 usually gives you enough depth of field for most subjects. But in macro photography, where you are centimeters from your subject, even f/16 might only render a few millimeters of depth in sharp focus. Stopping down further to f/22 or beyond introduces diffraction, which softens the entire image. Focus stacking lets you shoot at your lens’s sharpest aperture, typically f/5.6 to f/8, and still achieve edge-to-edge sharpness across the full depth of the scene.
Landscape photographers also use focus stacking when a scene includes a very close foreground element, such as a flower, rock, or tide pool, alongside a distant background. Rather than relying on hyperfocal distance focusing and accepting a compromise, you can take one frame focused on the foreground and another on the background, then stack them for perfect sharpness everywhere.
How to Shoot a Focus Stack
1. Use a Tripod and Lock Everything Down
A stable tripod is essential. The images in a stack must align precisely, so any shift in camera position between frames makes the merge harder and can introduce artifacts. Turn off image stabilization (it can cause micro-shifts between frames on a locked-down tripod), and use a remote shutter release or your camera’s self-timer to eliminate vibration from pressing the shutter button.
2. Switch to Manual Focus and Manual Exposure
Set your camera to manual mode so the exposure stays consistent across all frames in the stack. If exposure varies between shots, the merged result will have uneven brightness. Lock your white balance as well. If it shifts between frames, you will see color banding in the final image.
Switch your lens to manual focus. You will adjust the focus ring between each shot, moving the focus point gradually from the nearest part of the scene to the farthest. Autofocus is too unpredictable for this kind of precision work.
3. Choose Your Aperture
Shoot at the aperture where your lens is sharpest, usually between f/5.6 and f/8. There is no need to stop down to f/16 or f/22 because you are stacking multiple frames to build depth of field. Shooting at the sweet spot gives you the sharpest individual frames, which produce a sharper final stack.
4. Capture the Stack
Focus on the nearest point you want sharp and take a shot. Then turn the focus ring slightly to move the focus point deeper into the scene and take another shot. Repeat this process, advancing the focus point each time, until you have covered the farthest point you want in focus.
The number of frames depends on the depth of the scene, your aperture, and your distance from the subject. A macro stack of a small insect or flower might require 20 to 50 frames or even more at very close distances. A landscape stack with a foreground rock and distant mountains might need only 2 to 5 frames. Product shots typically fall somewhere in between, with 5 to 15 frames covering a small object at moderate distances.
Overlap your focus zones generously. Each frame should have a significant area of sharpness that overlaps with the previous frame so the software can blend them seamlessly. If you leave gaps, the final image will have soft bands where no frame was focused. A good rule of thumb is to advance the focus point by roughly one-third to one-half of the current depth of field between each shot. When in doubt, take more frames with smaller focus increments. Extra frames cost nothing but slightly more time in merging, while gaps in focus coverage are difficult to fix.
5. Use Focus Bracketing for Automation
Many modern cameras have a built-in focus bracketing mode that automates the stacking process. You set the starting focus point, the step size, and the number of frames, and the camera fires the entire sequence automatically. This is faster and more consistent than adjusting the focus ring by hand, and it minimizes the risk of accidentally bumping the camera between shots.
When using focus bracketing, start with a moderate step size and review the results. If the merged image shows soft bands, reduce the step size and reshoot. Some cameras also let you preview the depth of field coverage for the programmed sequence, which helps you dial in the settings before committing to the full shoot. Focus bracketing is especially useful for macro work, where the number of frames is high and precise manual adjustment of the focus ring is tedious.
Merging Your Focus Stack in Software
After capturing the stack, you need software to analyze each frame, identify the sharpest regions, and blend them into a single composite. Several options exist.
General photo editors. Most professional photo editing software can perform focus stacking by loading the frames as layers, auto-aligning them, and then auto-blending to keep only the sharp areas from each frame. This approach works well for simple stacks of 5 to 15 frames.
Dedicated stacking software. Applications built specifically for focus stacking often produce better results than general-purpose editors, especially with complex stacks of 20 or more frames. They offer multiple rendering methods (weighted average, depth map, retouching) and give you fine control over how overlapping areas are blended. For serious macro work, dedicated stacking tools are worth learning.
In-camera stacking. Some cameras can merge the focus stack internally, producing a single stacked image without external software. The results are usually acceptable for quick previews, but external software gives you more control and better quality for final output.
Focus Stacking for Macro vs. Landscapes
The technique is the same in principle, but the practical considerations differ significantly between macro and landscape applications.
Macro focus stacking involves very small focus steps and many frames. Depth of field at macro distances is measured in millimeters, so you may need 30, 50, or even 100 frames to cover a subject just a few centimeters deep. Subject movement is the biggest challenge: even a slight breeze can shift a flower between frames, creating ghosting artifacts. Work in still conditions, use a fast shutter speed to freeze any vibration, and consider a macro focusing rail for precise, repeatable focus adjustments.
Landscape focus stacking uses larger focus steps and fewer frames, typically 2 to 5. The goal is usually to bridge the gap between a close foreground and a distant background. Focus one frame on the foreground element and another at or near infinity. The blending is simpler because fewer frames are involved, and subject movement between frames is usually less of an issue (unless waves, grass, or clouds are moving). Landscape stacks often combine well with exposure blending when the scene also has a wide brightness range.
Common Focus Stacking Mistakes
- Not enough overlap between frames. If your focus steps are too large, the merged image will have soft bands. When in doubt, take more frames with smaller focus increments.
- Subject movement between frames. Wind blowing a flower or an insect shifting position between shots creates ghosting artifacts in the merge. Shoot in calm conditions, use a fast burst rate, and check each frame before moving on.
- Changing exposure between frames. Shooting in any automatic mode can cause slight exposure shifts from frame to frame. Always use full manual mode with locked settings.
- Using too narrow an aperture. The whole point of stacking is to avoid diffraction. Shoot at f/5.6 to f/8, not f/22.
- Forgetting to turn off image stabilization. On a tripod, stabilization can introduce slight shifts between frames that make alignment harder.
- Moving the camera between shots. Even touching the focus ring can shift the camera slightly. Use a focusing rail for macro work, or use in-camera focus bracketing to eliminate the need to touch the camera.
- Not shooting enough frames. It is always better to have more frames than you need. You can discard extras during merging, but you cannot fill gaps after the shoot is over.
When to Use Focus Stacking
- Macro photography, the most common use case, where depth of field is measured in millimeters
- Product photography, commercial shots of small objects like jewelry, watches, and electronics where every surface must be sharp
- Landscape photography, when a dramatic foreground element is very close to the camera
- Astrophotography, stacking a sharp foreground with a separately focused sky
- Scientific and technical photography, where complete sharpness across a specimen or sample is required for documentation