Depth of Field Calculator
Calculate DoF, hyperfocal distance, and near/far limits
Depth of field is the zone in front of and behind the focus point that looks acceptably sharp in the final image. It gets shallower with a wider aperture, a longer focal length, a closer subject, or a larger sensor at the same framing. Enter the sensor format, focal length, f-number, and subject distance; the calculator returns the near and far limits of sharpness, the total depth of field, and the hyperfocal distance for that lens and aperture.
Calculator Inputs
Determines Circle of Confusion
Results
Enter values above to see your results
Results use thin-lens formulas and a fixed circle of confusion per format; real lenses, focus breathing, and your viewing size will shift the limits. Treat the figures as planning estimates.
How It Works
Hyperfocal distance H = f² ÷ (N × c) + f, where f is focal length in mm, N the f-number, and c the circle of confusion for the sensor (0.030 mm full frame, 0.020 mm APS-C, 0.015 mm Micro Four Thirds, 0.050 mm 645 medium format). With subject distance s (measured from the lens), near limit = H × (s − f) ÷ (H + s − f) and far limit = H × (s − f) ÷ (H − s + f). When s is at or beyond H the far limit is infinity. Total depth of field is far minus near.
What the circle of confusion means
A point that is out of focus is rendered as a small disc. The circle of confusion is the largest disc that still looks like a sharp point when the image is viewed as an 8 × 10 in print from about 25 cm, the traditional standard. Smaller sensors are enlarged more to reach that print size, so they need a smaller c. If you view at 100% on a high-resolution screen or make very large prints, the effective c is smaller and the real depth of field is shallower than the calculator shows; the figures are a convention, not a hard boundary.
Using the hyperfocal distance
Focusing exactly at H makes everything from H ÷ 2 to infinity acceptably sharp, which is the largest possible depth of field for that lens and aperture. For a 24 mm lens at f/11 on full frame, H is about 1.77 m, so focusing at 1.8 m keeps everything from 0.9 m to the horizon within the sharpness criterion. Focusing a little past H costs sharpness in the foreground; focusing short of it loses infinity.
Worked example
Default inputs: full frame, 50 mm, f/8, subject at 5 m
50² ÷ (8 × 0.03) + 50 = 10,417 + 50 mm= 10.47 m10,467 × 4,950 ÷ (10,467 + 4,950)= 3.36 m10,467 × 4,950 ÷ (10,467 − 4,950)= 9.39 m9.39 − 3.36= 6.03 m (1.64 m in front, 4.39 m behind)At f/2.8 with the same framing the depth of field shrinks to about 1.7 m (4.25 m to 5.94 m). At f/22 the hyperfocal distance drops to 3.84 m, the 5 m subject is beyond it, and the far limit becomes infinity.
Tips & Best Practices
- •For landscapes, focus at or slightly beyond the hyperfocal distance rather than at infinity.
- •A lower f-number (wider aperture) gives a shallower depth of field; stopping down to very small apertures (f/16 and beyond on full frame, f/8 on Micro Four Thirds) starts to soften the whole image through diffraction.
- •Depth of field is not split evenly: at moderate distances roughly one third lies in front of the subject and two thirds behind, as the default example shows.
Frequently Asked Questions
Why is the far limit shown as infinity?
When the subject distance is at or beyond the hyperfocal distance, the far limit of acceptable sharpness extends to infinity by definition. Everything from the near limit outward is within the circle-of-confusion criterion.
Does crop factor change depth of field?
For the same lens, aperture, and distance, a smaller sensor gives slightly less depth of field because its circle of confusion is smaller. But a smaller sensor also needs a shorter focal length to frame the same scene, and that effect dominates: at equal framing and f-number, a crop sensor shows more depth of field than full frame, by roughly the crop factor in stops.
Is subject distance measured from the sensor or the lens?
The formulas here measure from the lens (approximately its front nodal point). Camera focus scales measure from the sensor plane, marked by a circle-with-line symbol on the body. The difference equals the focal length plus a few millimetres, which is negligible at portrait and landscape distances but matters in macro work.
Related Calculators
Exposure Value (EV) Calculator
Calculate EV based on ISO, Aperture, and Shutter Speed
Pixels to Print Size
Calculate maximum print size from image pixels and DPI
Golden Ratio Calculator
Calculate dimensions based on the Golden Ratio (Phi)
Unit Converter
Convert between different units of length, weight, volume, and temperature.