Depth of field & exposure calculators
All tools
Home / Guides / The depth of field formula, with worked examples

The depth of field formula, with worked examples

Every depth of field calculator, lens scale and app uses the same three equations. Here they are, what each symbol means, and three examples worked through number by number.

By the Feeed team · · 6 min read

Depth of field looks like a property of the lens, but it is really the output of a short calculation with four inputs: focal length, aperture, focus distance and a blur limit called the circle of confusion. Once you know the formula you can check any calculator, understand why the numbers change the way they do, and work out the sharp zone in your head when a rough answer is enough.

The three equations

All the results on this site come from the standard thin-lens depth of field equations — the same ones used by DOFMaster and by the distance scales engraved on manual-focus lenses. Work in millimetres throughout.

1. Hyperfocal distance: H = f² ÷ (N × c) + f

2. Near limit: Dn = s × (H − f) ÷ (H + s − 2f)

3. Far limit: Df = s × (H − f) ÷ (H − s), which becomes infinity when s ≥ H

The depth of field is simply Df − Dn. The symbols are:

  • f — the real focal length printed on the lens, not a full-frame equivalent. A phone’s "24 mm" main camera is really about 7 mm.
  • N — the f-number you shoot at, such as 1.8 or 8.
  • s — the focus distance, measured from the sensor plane (the ⦵ mark on the camera body).
  • c — the circle of confusion: the largest blur spot that still looks like a sharp point in the final image.

The hyperfocal distance does the heavy lifting. It is the focus distance at which the far limit just reaches infinity, and both limits are written in terms of it. Notice that H grows with the square of the focal length but only linearly with the f-number: doubling the focal length quadruples it, while stopping down one stop (multiplying N by 1.4) only shrinks it by 30%.

Choosing the circle of confusion

The circle of confusion is the only input that is a convention rather than a measurement. The usual rule is the sensor diagonal divided by about 1,440 to 1,500, which corresponds to an 8 × 10 inch print viewed from around 25 cm by someone with normal eyesight. We use diagonal ÷ 1443, which gives the familiar 0.030 mm for full frame:

FormatSensorDiagonalCircle of confusion
Full frame36 × 24 mm43.3 mm0.030 mm
APS-C (1.5×)23.5 × 15.6 mm28.2 mm0.020 mm
Canon APS-C (1.6×)22.3 × 14.9 mm26.8 mm0.019 mm
Micro Four Thirds17.3 × 13 mm21.6 mm0.015 mm
1-inch13.2 × 8.8 mm15.9 mm0.011 mm
Medium format (44×33)43.8 × 32.9 mm54.8 mm0.038 mm
Phone main camera (1/1.3″)9.8 × 7.4 mm12.3 mm0.009 mm

Smaller sensors get a smaller circle of confusion because their images are enlarged more to reach the same print size. If you judge sharpness at 100% on a high-resolution screen, halve the value: depth of field shrinks roughly in proportion and the hyperfocal distance doubles.

Example 1: a portrait at f/1.8

An 85 mm lens at f/1.8 on full frame (c = 0.030 mm), focused on an eye 2.5 m (2,500 mm) away.

  1. Hyperfocal distance. f² = 85² = 7,225. N × c = 1.8 × 0.03 = 0.054. 7,225 ÷ 0.054 = 133,796, plus f gives H = 133,881 mm, or 134 m.
  2. Near limit. s × (H − f) = 2,500 × 133,796 = 334,490,741. Divide by H + s − 2f = 136,211 to get Dn = 2,455.7 mm.
  3. Far limit. The same numerator divided by H − s = 131,381 gives Df = 2,546.0 mm.
  4. Depth of field. 2,546.0 − 2,455.7 = 90.3 mm: 4.4 cm in front of the eye and 4.6 cm behind it.
hyperfocal 134 m∞near2.46 mfar2.55 mfocus 2.50 m0.1 m0.5 m1 m2 m3 m5 m10 m30 m
Example 1: 85 mm f/1.8 focused at 2.5 m on full frame — 9.0 cm of depth of field.

That is less than the depth of a human head, which is why eye-detection autofocus matters so much with fast portrait lenses. The split is almost even — 49% in front, 51% behind — because the subject is far closer than the hyperfocal distance.

Cross-check with the short-cut. When s is much smaller than H, the equations simplify to DoF ≈ 2 × N × c × s² ÷ f². Here: 2 × 1.8 × 0.03 × 2,500² ÷ 85² = 93.4 mm, within 3% of the exact result. The short-cut is handy in the field because it shows the scaling at a glance: double the distance and depth of field grows four times; double the focal length and it falls to a quarter.

Example 2: a landscape on APS-C

A 16 mm lens at f/11 on a 1.5× APS-C camera (c = 0.020 mm).

  1. Hyperfocal distance. 16² = 256; 11 × 0.02 = 0.22; 256 ÷ 0.22 = 1,163.6; plus 16 gives H = 1,179.6 mm — just 1.18 m (3.87 ft).
  2. Focused at H. Put s = H into the near-limit equation and it reduces to exactly H ÷ 2: everything from 59 cm (1.94 ft) to infinity is acceptably sharp.
  3. Focused at 1 m instead. Near limit: 1,000 × 1,163.6 ÷ 2,147.6 = 541.8 mm. Far limit: 1,000 × 1,163.6 ÷ 179.6 = 6,478 mm, or 6.48 m.

Focusing a little closer than the hyperfocal distance pulls the near limit in only slightly (from 59 cm to 54 cm) but drags the far limit from infinity down to 6.48 m. For a landscape where the horizon matters, that is a bad trade, which is why the usual advice is to err on the far side of the hyperfocal distance. Notice also that the far-limit equation is very sensitive near H: its denominator H − s approaches zero, so small focusing errors make a big difference to how sharp the distance looks.

Example 3: checking against DOFMaster

The classic reference case: a 50 mm lens at f/8 on full frame focused at 10 ft (3,048 mm), c = 0.030 mm. DOFMaster lists a near limit of 7.77 ft, a far limit of 14.0 ft and a hyperfocal distance of 34.3 ft.

  1. H = 2,500 ÷ (8 × 0.03) + 50 = 10,466.7 mm = 34.3 ft.
  2. Dn = 3,048 × 10,416.7 ÷ 13,414.7 = 2,366.8 mm = 7.77 ft.
  3. Df = 3,048 × 10,416.7 ÷ 7,418.7 = 4,279.7 mm = 14.0 ft.
hyperfocal 10.5 m∞near2.37 mfar4.28 mfocus 3.05 m0.1 m0.5 m1 m2 m3 m5 m10 m20 m
Example 3: 50 mm f/8 focused at 10 ft on full frame — sharp from 7.77 ft to 14.0 ft.

The results match the published values, and the same reference case is part of this site’s automated tests, so the calculator, the lens tables and this guide all agree. Total depth of field is 6.28 ft, about 36% of it in front of the subject — the familiar "one third in front, two thirds behind" rule, which holds at moderate distances like this one.

What the formula tells you

  • Aperture enters through H: well inside the hyperfocal distance, depth of field is roughly proportional to N, so going from f/2.8 to f/5.6 about doubles it.
  • Distance appears squared in the short-cut, which makes it the most powerful control of all.
  • Focal length appears squared in the denominator. At the same framing, though, distance rises in step with focal length and the two effects cancel, which is why a 35 mm and an 85 mm lens give similar depth of field for the same head-and-shoulders portrait.
  • Sensor size works through c and through the shorter lens you need for the same framing. That is the origin of the "multiply the f-number by the crop factor" rule explained in the crop factor guide.

Where the formula stops working

The thin-lens equations assume the subject is much farther away than the focal length. At macro distances, near 1:1 magnification, they lose accuracy because the lens no longer behaves like a single thin lens; there it is better to work from magnification: DoF ≈ 2 × N × c × (m + 1) ÷ m². They also treat depth of field as a hard edge, when really sharpness falls off gradually — objects just beyond the far limit are only slightly soft. And they ignore diffraction, which at very small apertures softens everything, so the extra depth from f/22 comes at the cost of overall sharpness.

For everything else — portraits, street, landscapes, products — the equations are reliable to a few percent. Try them on your own lenses with the depth of field calculator and the hyperfocal calculator, read the concepts behind them in depth of field explained, or browse ready-made tables for popular lenses.

Check your own numbers in the depth of field calculator →