Understanding the depth of field calculator — concept and principle
Depth of field (DoF) is the range of distances in front of the camera that look acceptably sharp in a photo. This calculator gives the near and far limits of that zone and the hyperfocal distance from the focal length, aperture, subject distance and sensor size. Photographers use it to decide whether a portrait background will blur, whether a group shot will be sharp front to back, or where to focus for a landscape.
How it is calculated
With focal length f, f-number N, subject distance s and circle of confusion c (all in mm):
- Hyperfocal distance H = f² / (N × c) + f
- Near limit = s(H − f) / (H + s − 2f)
- Far limit = s(H − f) / (H − s), or infinity when s ≥ H
- Depth of field = far limit − near limit
The circle of confusion is 0.030 mm for full frame and is scaled down for smaller sensors by their crop factor. Results are rounded to 0.01 m.
The principle
A lens focuses exactly only one distance. Points nearer or farther form small blur discs on the sensor instead of points. If a disc is smaller than the circle of confusion, the eye cannot tell it from a point at normal print size and viewing distance, so it counts as sharp. A smaller aperture (larger N) narrows the cone of light and shrinks the blur discs, so DoF grows. A longer focal length or closer subject magnifies the image and the blur, so DoF shrinks. For distances well below H, DoF ≈ 2Ncs²/f². Focusing at the hyperfocal distance makes everything from about H/2 to infinity acceptably sharp.
Worked example
Defaults: 50 mm, f/2.8, subject at 3 m (3,000 mm), full frame c = 0.030 mm.
- H = 50² / (2.8 × 0.030) + 50 = 2,500 / 0.084 + 50 ≈ 29,811.9 mm ≈ 29.81 m.
- Near = 3,000 × 29,761.9 / (29,811.9 + 3,000 − 100) ≈ 2,729.5 mm ≈ 2.73 m.
- Far = 3,000 × 29,761.9 / (29,811.9 − 3,000) ≈ 3,330.1 mm ≈ 3.33 m.
- DoF = 3,330.1 − 2,729.5 ≈ 600.6 mm ≈ 0.6 m, matching the calculator.
How to read the result
About 0.27 m of the zone lies in front of the subject and 0.33 m behind it; at moderate distances the zone extends a little further behind. Under a metre of DoF at 3 m suits a portrait with a softened background; for a landscape you want the far limit at infinity. If the far limit shows infinity, your subject is at or beyond H.
Common mistakes
- Treating DoF as a hard edge. Sharpness falls off gradually.
- Ignoring the circle of confusion: large prints, cropping or 100 % pixel viewing need a smaller c than 0.030 mm.
- Using the equivalent focal length with a crop sensor while also changing c.
Frequently asked questions
What is the hyperfocal distance for 24 mm at f/8 on full frame?
About 2.4 m (576 / 0.24 + 24 ≈ 2,424 mm).
Why is depth of field so shallow at f/1.4?
DoF is roughly proportional to the f-number, so f/1.4 gives about half the DoF of f/2.8.
Does a smaller sensor give more depth of field?
For the same framing and f-number, yes, because you use a shorter focal length.
Sources: S. F. Ray, Applied Photographic Optics, Focal Press · R. Kingslake, Optics in Photography, SPIE Press