What depth of field is and when to use it
Depth of field (DOF) is the zone in front of and behind your focus point that still looks acceptably sharp in a photo. It is not a hard line — sharpness fades gradually — but photographers use a "circle of confusion" threshold (the largest blur spot the eye still reads as a point) to define practical near and far limits. A shallow depth of field (a thin sharp zone with a blurry background) is the signature look of portraits shot at wide apertures like f/1.8, while a large depth of field (most of the scene in focus) is typical of landscape photography shot at f/11 or narrower.
Use this calculator before a shoot to decide what aperture, focal length, and distance combination will keep your subject sharp while blurring (or including) the background as intended. It is especially useful for macro and portrait work, where DOF can be a matter of centimeters, and for landscape work, where you want to know the hyperfocal distance that keeps everything from a certain point to infinity in focus.
The formula
The calculator first finds the hyperfocal distance, then uses it to find the near and far limits of sharp focus:
- Hyperfocal distance H = f² ÷ (N × c) + f, where f = focal length, N = f-stop (aperture), and c = circle of confusion for the sensor size.
- Near limit = (H × s) ÷ (H + (s − f)), where s = subject distance.
- Far limit = (H × s) ÷ (H − (s − f)), or infinity if this denominator is zero or negative (meaning the subject is at or beyond the hyperfocal distance).
The circle of confusion (c) depends on sensor size because smaller sensors need a stricter (smaller) threshold to look equally sharp when the image is enlarged the same amount — this calculator uses 0.030 mm for full frame, 0.020 mm for APS-C, 0.015 mm for Micro Four Thirds, and 0.040 mm for medium format, standard reference values used in photography.
Worked example
For a 50mm lens at f/2.8, focused on a subject 3 meters away, on a full-frame sensor (c = 0.030 mm): Hyperfocal distance H = 50² ÷ (2.8 × 0.030) + 50 = 2500 ÷ 0.084 + 50 ≈ 29,762 + 50 = 29.81 m. Near limit = (29,811.9 × 3000) ÷ (29,811.9 + 2950) ≈ 2.73 m. Far limit = (29,811.9 × 3000) ÷ (29,811.9 − 2950) ≈ 3.33 m. That gives a total depth of field of about 3.33 − 2.73 = 0.60 m — matching what the calculator returns for these exact inputs.
Common mistakes and how to interpret the result
- Confusing focal length with "zoom level." Enter the actual focal length in millimeters printed on the lens (e.g., 50, 85, 200), not a digital zoom multiplier or crop-adjusted "equivalent" focal length.
- Forgetting that sensor size changes the result. The same lens and aperture produce a different depth of field on different sensor sizes because the circle of confusion — and the required enlargement to view the image — changes; always select the correct sensor format.
- Assuming DOF is split evenly in front of and behind the subject. It is not — roughly one-third of the sharp zone typically falls in front of the focus point and two-thirds behind it, which is why the near and far limits in the example above are not symmetric around 3 m.
- Ignoring the hyperfocal distance for landscapes. Focusing exactly at the hyperfocal distance (rather than at infinity) maximizes how much of the scene, from half that distance to infinity, appears sharp — a classic landscape technique.