Astrophoto Depth of Field & Hyperfocal Distance

Calculate hyperfocal distance for sharp foreground & star-field shots

Enter focal length, aperture and sensor format to compute hyperfocal distance, plus the near and far limits of acceptable sharpness at any focus distance. Built for landscape and Milky Way astrophotographers who need a sharp foreground and stars at infinity. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is hyperfocal distance?

It is the closest focus distance at which objects all the way to infinity stay acceptably sharp. When you focus exactly at the hyperfocal distance, the depth of field extends from half that distance out to infinity, giving the most front-to-back sharpness possible at a given focal length and aperture.

For wide landscape and Milky Way photography, the trick is getting both a near foreground and the stars at infinity acceptably sharp in one frame. The hyperfocal distance is the focus point that does exactly that. This calculator finds it for your lens and sensor, and shows the near and far limits at any focus distance.

How it works

The hyperfocal distance depends on focal length, aperture and how forgiving your sensor is about blur (the circle of confusion):

H = f² ÷ (N × c) + f

where f is focal length in mm, N is the f-number, and c is the circle of confusion for your format. Focus at H and everything from H/2 to infinity is acceptably sharp.

For a subject focused at distance s, the sharp zone runs between:

near = s(H − f) ÷ (H + s − 2f) far = s(H − f) ÷ (H − s)

When s reaches H, the far limit goes to infinity — that is the hyperfocal condition.

Circle of confusion by sensor format

Sensor formatCircle of confusion (c)Notes
Full frame (35mm)~0.029 mmMost versatile for landscape + astro
APS-C (Canon EF-S)~0.019 mm1.6× crop factor
APS-C (Nikon DX / Sony APS-C)~0.020 mm1.5× crop factor
Micro Four Thirds~0.015 mm2× crop factor
Medium format (50MP+ back)~0.040–0.050 mmMore forgiving depth of field

Smaller sensors demand tighter focus tolerance, which pushes the hyperfocal distance further out — meaning you need to be further from your foreground subject for everything to stay sharp to infinity at a given aperture.

Worked examples

24mm lens at f/8, full frame (c = 0.029 mm):

H = (24² ÷ (8 × 0.029)) + 24 = (576 ÷ 0.232) + 24 ≈ 2,507 mm ≈ 2.5 m

Focus at 2.5 m and everything from 1.25 m to infinity is acceptably sharp. A foreground boulder 1.5 m away and the Milky Way at effectively infinite distance are both within the sharp zone.

16mm lens at f/4, APS-C (c = 0.020 mm):

H = (256 ÷ (4 × 0.020)) + 16 = (256 ÷ 0.08) + 16 = 3,200 + 16 ≈ 3.2 m

Even at f/4 this wide, the hyperfocal distance is manageable. Focus at 3 m and foreground detail from about 1.5 m to stars at infinity all stay sharp.

Astrophotography considerations

For Milky Way photography specifically, the hyperfocal approach has one complication: long exposures at wide apertures may show diffraction if you stop down too far for a shorter hyperfocal distance. The practical balance for most astrophotographers is:

  • Shoot at f/2.8 or wider to capture enough light in a 15–25 second exposure
  • Use a 14–24 mm lens where hyperfocal distances at f/2.8 are reachable from a reasonably placed foreground
  • At f/2.8 on full frame, a 20mm lens has a hyperfocal distance of about 14 m — so foreground subjects closer than 7 m will be slightly soft

When the foreground must be close, focus stacking (one exposure focused on the foreground, one on stars) gives pixel-level sharpness that no single-exposure focus compromise can match.

Notes

“Acceptably sharp” is judged at normal print-viewing size, so for big enlargements or critical pixel-level sharpness, focus a little past the hyperfocal distance or stop down one more stop. All calculations run locally in your browser.