What is depth of field?
Depth of field (DoF) is the range of distances in a scene that appear acceptably sharp in a photograph. Only one exact plane is in perfect focus, but objects somewhat nearer and farther still look sharp because their blur stays below a threshold called the circle of confusion. This calculator uses pure geometric optics, so it applies to any camera anywhere — no country-specific assumptions.
How to use this calculator
Enter four values: the lens focal length in millimeters, the f-number (aperture, e.g. 2.8 for f/2.8), the distance to subject in meters, and the circle of confusion in millimeters. Use 0.03 mm for full-frame 35mm sensors and roughly 0.02 mm for APS-C. The tool returns the front and back depth of field (measured from the subject), the total depth of field, the near and far focus limits, and the hyperfocal distance.
The formula explained
First the hyperfocal distance is computed as $$H = \frac{f^{2}}{N \cdot c} + f.$$ The near focus limit is $$D_{near} = \frac{s\,(H - f)}{H + s - 2f}$$ and the far limit is $$D_{far} = \frac{s\,(H - f)}{H - s},$$ with all lengths in mm (subject distance is converted from meters by multiplying by 1000). When the subject distance reaches or exceeds the hyperfocal distance, the far limit becomes infinity and depth of field extends forever.
Worked example
For a 50 mm lens at f/2.8, focused at 10 m (\(s = 10000\) mm) with \(c = 0.03\) mm: $$H = \frac{2500}{0.084} + 50 = 29811.90 \text{ mm}.$$ $$D_{near} = \frac{10000 \times 29761.90}{39711.90} = 7494.46 \text{ mm}$$ and $$D_{far} = \frac{10000 \times 29761.90}{19811.90} = 15022.74 \text{ mm}.$$ So front DoF = 2505.54 mm (~2.51 m), back DoF = 5022.74 mm (~5.02 m) and total DoF = 7528.28 mm (~7.53 m).
Key Terms and Variables
- Focal length, \(f\) (mm): the lens focal length as marked on the lens. It is used in millimetres in all the formulas.
- F-number, \(N\) (unitless): the ratio of focal length to aperture diameter, for example f/2.8 means \(N = 2.8\). A larger \(N\) means a smaller aperture and more depth of field.
- Subject distance, \(s\) (mm in the formula, m in the calculator): the distance from the camera to the plane of sharp focus. The calculator takes metres and converts with \(s = 1000 \cdot \text{distance (m)}\).
- Circle of confusion, \(c\) (mm): the acceptable blur-spot diameter on the sensor, which defines what counts as acceptably sharp. It depends on sensor size and viewing conditions (see the table above).
- Hyperfocal distance, \(H\) (mm): the focus distance at which the far limit of sharpness reaches infinity. It is calculated as \(H = \dfrac{f^{2}}{N \cdot c} + f\). Focusing at \(H\) makes everything from about \(H/2\) to infinity acceptably sharp.
- Near focus limit, \(D_{near}\) (mm): the closest distance that appears acceptably sharp, calculated as \(D_{near} = \dfrac{s\,(H - f)}{H + s - 2f}\).
- Far focus limit, \(D_{far}\) (mm): the farthest distance that appears acceptably sharp, calculated as \(D_{far} = \dfrac{s\,(H - f)}{H - s}\). When \(s \ge H\) the far limit is infinity.
- Front depth of field (mm or m): the sharp zone in front of the subject, \(s - D_{near}\).
- Back depth of field (mm or m): the sharp zone behind the subject, \(D_{far} - s\). Behind the subject it is usually larger than in front.
- Total depth of field, DoF (mm or m): the whole zone of acceptable sharpness, \(\text{DoF} = D_{far} - D_{near}\), which equals the front DoF plus the back DoF.
FAQ
Why is back depth of field larger than front? For typical subject distances the in-focus zone extends roughly twice as far behind the subject as in front, because the optics are not symmetric around the focus plane.
What does "infinity" mean in the result? When you focus at or beyond the hyperfocal distance, everything from the near limit out to infinity is sharp, so the far limit and total DoF are infinite.
How do I get more depth of field? Use a smaller aperture (higher f-number), a shorter focal length, or focus farther away.