Near–Far Focus & Aperture Calculator

Set the nearest and farthest details that need to look sharp, then see where to focus and how far to stop down. The result also checks the lens limit and compares diffraction with your chosen sharpness allowance.

Your numbers
Use the lens’s actual focal length, not its full-frame-equivalent focal length.
Measure from approximately the lens’s front principal plane to the nearest required detail.
Choose infinity for scenes whose distant horizon must remain acceptably sharp.
Used only when the farthest required detail is a measured distance.
The presets supply conventional sensor-plane circles of confusion; choose custom for demanding crops or prints.
Used only with the custom sharpness standard; smaller values demand more depth of field.
550 nm represents green light and is the conventional visible-light estimate.
Enter the largest f-number printed on the lens, such as 16 or 22.

What this calculator leaves out

  • This is a thin-lens estimate using a conventional acceptable-sharpness criterion, not a measurement of your particular lens or camera.
  • Diffraction onset is gradual, and lens aberrations, focus error, motion blur, atmospheric haze, cropping, print size, and viewing distance are not modeled.
  • This calculator is educational, not professional optical advice; confirm critical work with test photographs.

By using this calculator you agree to the Terms of Use. Results are estimates, not professional advice.

Equal-blur focus distance (m)3.92

Exact required aperture
f/7.1
Suggested camera f-stop
f/7.13
Achieved near limit (m)
2
Achieved far limit (m)
110.59
Airy disk diameter (µm)
9.56
Diffraction comparison aperture
f/14.9
Single-exposure assessment
The requested range is covered at f/7.13, and its Airy disk is within the selected blur allowance.

Uses a thin-lens depth-of-field model and the selected circle of confusion, rather than measured lens performance.

At close or macro distances, effective aperture and pupil magnification can materially change the result.

How to use this calculator

  1. Enter the lens’s actual focal length and the distance to the nearest detail that matters.
  2. Choose a measured far detail or infinity, then enter the far distance when needed.
  3. Choose a sensor preset or enter the circle of confusion you want to use.
  4. Enter the lens’s largest available f-number and read the suggested setting and assessment.

How the focus distance and aperture are calculated

This calculator starts with the part of the scene you need to hold: a near boundary and a far boundary. Instead of focusing halfway by distance, it chooses the focus distance that gives those two boundaries equal geometric blur. For a finite far boundary, the focus distance is the harmonic mean:

s = 2 × Dn × Df ÷ (Dn + Df)

Here, Dn is the near distance and Df is the far distance, with all distances converted to millimetres. If the far boundary is infinity, the limiting solution is s = 2 × Dn. That is why the useful focus point is usually much closer to the foreground than the visual midpoint of a landscape.

The calculator then finds the hyperfocal term that puts both boundaries at the chosen circle of confusion and derives the theoretical aperture:

H = Dn × (s − f) ÷ (s − Dn) and Nreq = f² ÷ (c × H)

f is focal length, c is the acceptable circle of confusion, and Nreq is the required f-number. For an infinity boundary, H = s − f. The result rounds Nreq upward to the next one-third stop, so rounding never gives less geometric depth of field than requested. It then recalculates the near and far limits at that setting.

What changes the result most

Moving the near boundary closer has a large effect because depth of field is not shared evenly around the focus point. A longer focal length and a smaller circle of confusion both demand a smaller physical aperture, shown as a larger f-number. A strict circle of confusion may suit a large print or a heavy crop, but it can make a one-shot result impractical.

The diffraction comparison gives a second constraint. The Airy-disk diameter is estimated as a = 2.44 × λ × N, where λ is the chosen wavelength and N is the suggested f-number. It is compared with the selected circle of confusion. Diffraction grows gradually, so this is a tradeoff signal, not a cliff where a photograph suddenly becomes unusable.

What this calculator leaves out

The calculation is a thin-lens, paraxial model. It does not measure a particular lens’s aberrations, field curvature, focus shift, aperture calibration, sensor filtering, sharpening, motion blur, haze, crop, print size, or viewing distance. At macro distances, effective f-number and pupil magnification matter, so use a macro-specific calculation or test photograph rather than treating these limits as exact.

Worked example

With a 24 mm lens, a near boundary at 2 m, a far boundary at 100 m, and the APS-C 0.020 mm circle of confusion, the equal-blur focus distance is 2 × 2,000 × 100,000 ÷ 102,000, or 3,921.57 mm (3.92 m). The exact required aperture is about f/7.10, which rounds upward to the f/7.13 one-third stop.

At f/7.13, the recalculated near limit is about 2.00 m and the far limit is about 110.59 m, so both requested boundaries are covered. With 550 nm light, the Airy disk is about 9.56 µm. The diffraction comparison aperture is f/14.9, so this setting remains below that comparison point.

Common questions

Why is the recommended focus distance not halfway between the two subjects?

Depth of field is governed by lens geometry, not equal linear distance in front of and behind the focus plane. The equal-blur solution uses a harmonic mean, which pulls the focus point toward the nearer detail. This gives the chosen near and far boundaries the same geometric blur allowance.

How do I measure focus distance in the field?

Measure from approximately the lens’s front principal plane to the subject, not from the camera’s rear screen or the end of the hood. The exact principal-plane position is rarely marked, so a practical estimate is usually adequate at ordinary landscape distances. Keep the method consistent for both boundaries.

What circle of confusion should I use for a large print or heavy crop?

Use a smaller circle of confusion when the final image will be enlarged more or inspected more closely. The preset values are conventional viewing assumptions rather than camera-specific limits. A custom value lets you make that requirement explicit, but it may demand a smaller aperture or focus stacking.

Why can stopping down further make the photograph softer?

A smaller physical aperture increases geometric depth of field, but also increases diffraction blur. The Airy-disk comparison in this calculator marks where that diffraction blur equals the selected circle of confusion. It is a gradual tradeoff, so the best choice depends on the lens, output size, and whether stacking is practical.

When should I focus stack instead of using a smaller aperture?

Consider stacking when the needed f-number is beyond the lens’s smallest aperture or beyond your diffraction comfort point. Take several frames focused through the depth of the scene and merge the sharp regions later. Movement in foliage, water, people, or changing light can make stacking unsuitable.

Can I use this calculator for macro photography?

It can show the trend, but ordinary thin-lens depth-of-field formulas become less reliable at macro magnifications. Effective f-number and pupil magnification change both depth of field and diffraction. Use a macro-focused model and confirm the result with test frames.

Put this calculator on your site

Paste the snippet below where you want the calculator to appear. It stays up to date automatically and links back here.

<iframe src="https://countfolk.com/embed/near-far-focus-aperture-calculator/" title="Near–Far Focus & Aperture Calculator" width="100%" height="640" style="border:0;max-width:44rem" loading="lazy"></iframe>