Skip to main content

Depth of Field (DoF) Calculator

Hyperfocal distance, near and far focus limits, and total depth of field from focal length, aperture, subject distance, and circle of confusion. Sensor format presets supply the CoC (Full Frame 0.043 mm, APS-C 0.029 to 0.030 mm, Micro Four Thirds 0.022 mm, 1-inch 0.019 mm, smartphone 1/2.3-inch 0.006 mm, medium format up to 0.072 mm), with a custom CoC field and selectable subject-distance units (feet, meters, inches, or centimeters).

Runs entirely in your browser

This tool sends nothing over the network. Everything you enter is processed on your device and never reaches our servers.

Optics
Cinematography
Loading the tool
Reference

Documentation

Depth of field (DoF) is the zone of acceptable sharpness in front of and behind the point of focus. It depends on camera sensor size, lens focal length, aperture, and subject distance, and the same calculation returns the hyperfocal distance and the split between near and far sharpness.

  • Sensor and film format presets, including full frame, APS-C variants, Micro Four Thirds, several compact sensors, and medium format, set the circle of confusion used in the calculation; a custom circle of confusion in millimeters covers any unlisted sensor.
  • Focal length is entered in millimeters as printed on the lens (50 for a 50mm prime, 200 for a 200mm telephoto), accepting fractions like 1/2 and mixed numbers.
  • Aperture is entered as an f-stop number. A wider aperture (smaller number) shrinks the depth of field; a narrower aperture (larger number) expands the zone of sharpness.
  • Subject distance, the distance from the camera sensor to the subject, is entered in feet, meters, inches, or centimeters.
  • Results report the near focus limit, far focus limit, total depth of field, hyperfocal distance, and the percentage of the depth of field in front of versus behind the subject.
  • Step-by-step formulas, the output distance unit, and decimal precision are all adjustable in advanced settings.

The hyperfocal distance is H = f² / (N × c) + f, where f is focal length, N is the f-number, and c is the circle of confusion. The near limit is Dn = s × (H - f) / (H + s - 2f). The far limit is Df = s × (H - f) / (H - s) when s is less than H, otherwise the far limit extends to infinity.

Focusing exactly at the hyperfocal distance (setting subject distance s equal to H) always puts the near limit at half of that distance and pushes the far limit to infinity. Substituting s = H into the near-limit formula gives Dn = H × (H - f) / (H + H - 2f) = H × (H - f) / (2 × (H - f)), and the (H - f) term cancels top and bottom, leaving Dn = H / 2. The far-limit formula only applies when s is less than H, so the moment s reaches H is exactly where the far limit switches from a finite distance to infinity. For a 24mm lens at f/11 with a typical full-frame circle of confusion near 0.03mm, H works out to roughly 1.8 meters, which puts the near limit at about 0.9 meters with everything beyond it rendered sharp to infinity.

Plan focus zones across portraits, landscapes, macro, and motion work. Knowing the precise boundaries of acceptable sharpness reduces wasted frames and supports deliberate creative choices about aperture, focus point, and composition.

  • Portrait Photography: Check whether an 85mm lens at f/1.8 focused at 8 feet keeps both eyes sharp while blurring the background. Compare results at f/2.8 to decide if stopping down is needed for group portraits.
  • Landscape Photography: Determine the hyperfocal distance for a 24mm lens at f/11 to maximize sharpness from foreground to distant mountains. The near limit value confirms whether close objects fall within the focus zone.
  • Macro Photography: Evaluate depth of field at very close focus distances, where the sharp zone shrinks to fractions of an inch. Plan focus stacking sequences by calculating focus plane shifts between shots.
  • Product Photography: Confirm that an entire product fits within the depth of field at close range. Compare aperture settings to find the minimum f-stop that keeps the full object sharp without diffraction softening.
  • Astrophotography: Verify that a wide-angle lens focused at the hyperfocal distance renders stars as points rather than blurs. Compare aperture settings to balance light gathering with depth of field.
  • Cinematography: Plan focus pulls by computing the near and far limits at each marked distance, so it is clear exactly when a subject walks into or out of the acceptable focus zone during tracking shots.
  • Education: Visualize how changing one variable (aperture, focal length, distance, or sensor size) affects the depth of field. Step-by-step formulas reinforce the math behind photographic optics.
Inputs, outputs, and what the Depth of Field (DoF) Calculator computes

What the Depth of Field (DoF) Calculator asks for and what it returns, as a plain list. Defaults, units, and ranges are the ones the form loads with.

Inputs

  • Camera Sensor / Film Format · default: Full Frame (35mm)
  • Custom Circle of Confusion (mm) (text input) · default: 0.029
  • Focal Length (mm) (text input) · default: 50
  • Aperture (f-stop) (text input) · default: 2.8
  • Subject Distance (text input) · default: 10
  • Distance unit · default: feet
  • Show step-by-step formulas · default: off
  • Output Distance Unit · default: feet
  • Decimal Places (numeric input) · default: 2 · range: 0 to 6

Controls

Calculate · Reset

Example

Substituting s = H into the near-limit formula gives Dn = H × (H - f) / (H + H - 2f) = H × (H - f) / (2 × (H - f)), and the (H - f) term cancels top and bottom, leaving Dn = H / 2.