How to calculate
Divide focal length squared by the product of aperture f-number and circle of confusion to get K. For focus distance s and focal length f, the near limit is K times s divided by K plus s minus f. The far limit uses K minus s plus f in the denominator and is infinite when that denominator is zero or negative.
Worked example
Use Actual focal length (mm) 50 · Aperture f-number 8 · Circle of confusion (mm) 0.03125 · Focus setting Known subject distance · Focus distance from lens 6.05 · Distance and output unit Meters. The result is 11.34375 m.
Input and result notes
Use the lens focal length in millimeters. Circle of confusion is an acceptable blur diameter on the sensor. Select it based on output size, viewing distance, and the sharpness you need.
University of Arizona camera optics and depth of field