Depth of Field Calculator
How much of a scene in front of and behind the focus stays sharp, and how thin is the in-focus slice under a microscope objective? The calculator gives the near and far limits and the hyperfocal distance of a camera lens, flags the f-number where diffraction starts to blur the whole image, and gives a microscope’s depth of field from its NA, magnification and camera. Background: f-number, depth of focus, numerical aperture, and Airy disk.
Three short experiments. Each one sets the inputs, says where to look, and asks for a prediction before it shows the result.
These checks run in your browser on every load. The closed forms are compared with values worked out by hand, and the near and far limits are confirmed by tracing the blur spot of a thin lens directly for 300 random lenses.
| Check | Expected | Computed | Tolerance |
|---|
The expected values follow the thin-lens depth-of-field relations in Ray, Applied Photographic Optics, and the microscope relation in Inoué and Spring, Video Microscopy, evaluated by hand for the stated cases. The tolerance is the largest relative difference from Expected that still passes.
A lens of focal length and f-number , focused at distance , images a point at any other distance as a blur spot on the sensor. Depth of field is the range of distances over which that spot stays smaller than the circle of confusion . For a thin lens with its entrance pupil at the lens,
where is the hyperfocal distance; for the far limit is infinite, and focusing at makes everything from to infinity sharp. The limits satisfy , so the sharp zone always reaches farther behind the subject than in front. Stopping down deepens it, but the diffraction spot, an Airy disk of diameter at magnification , grows with ; once it exceeds nothing in the image is sharp by that standard. The model ignores aberrations and treats the pupil magnification as one, which becomes rough in close-up work.
A microscope images a thin slice of the sample. Its total depth of field combines a wave-optical term, the axial extent of the diffraction-limited focus, with a geometric term set by the smallest detail the camera resolves, its pixel pitch referred back through the magnification :
with the index of the medium between the objective and the sample.
Worked example
A 50 mm lens at f/8 with a 0.03 mm circle of confusion has a hyperfocal distance of 10.47 m. Focused at 5 m, it is sharp from 3.389 m to 9.527 m: 1.611 m in front of the subject and 4.527 m behind. The Airy disk at 550 nm is 10.84 µm across, a third of the circle of confusion. Under a microscope, a 40× objective of NA 0.75 in air with a 6.5 µm pixel camera has a depth of field of 0.978 + 0.217 = 1.194 µm at 550 nm.
References: S. F. Ray, Applied Photographic Optics, 3rd ed. (Focal Press, 2002). S. Inoué and K. R. Spring, Video Microscopy, 2nd ed. (Plenum, 1997). W. J. Smith, Modern Optical Engineering, 4th ed. (McGraw-Hill, 2008).