StatGardenREF. DESK
Calculators/Photography/Depth of Field
Photography

Depth of Field calculator

Near and far sharpness limits from focal length, aperture, sensor format and subject distance.

What this calculator does

Depth of field is the zone in front of and behind the focused subject that still appears acceptably sharp. It narrows with a wider aperture (a smaller f-number), a longer focal length, a closer subject and a larger sensor, and widens as any of those move the other way.

The calculation runs through the hyperfocal distance, the focusing distance beyond which everything out to infinity stays acceptably sharp at a given aperture. Once the hyperfocal distance is known, the near and far limits for any closer subject distance follow directly from it.

The formula

FormulaH = f²/(N×c) + f; Near = (H×s)/(H+s−f); Far = (H×s)/(H−s+f), or infinity if s ≥ H

The circle of confusion is the largest blur spot that still reads as a sharp point on that sensor format, and it scales with sensor size. Hyperfocal distance H is f²/(N×c) + f, where f is focal length, N is the f-stop and c is the circle of confusion for the selected sensor. Near limit is (H×s)/(H+s−f) and far limit is (H×s)/(H−s+f), where s is subject distance; if the subject distance is at or beyond the hyperfocal distance, the far limit extends to infinity.

TermMeaning
Hyperfocal distanceThe focus distance beyond which everything to infinity is acceptably sharp, at a given focal length and aperture.
Circle of confusionThe largest blur spot on the sensor that still looks like a sharp point, a fixed published value per sensor format.
Near / far limitThe closest and furthest points from the camera that remain within acceptable sharpness for the focused subject.

The inputs explained

FieldWhat to enter
Focal length (mm) (mm)The focal length of the lens in millimetres, as printed on the lens.
Aperture (f-stop)The aperture the lens is set to, such as 8 for f/8.
Sensor formatThe sensor format of the camera, which sets the circle of confusion used in the calculation.
Subject distance (metres) (m)The distance from the camera to the focused subject, in metres.

When to use it

Landscape photography

Focusing near the hyperfocal distance at a moderate aperture keeps a scene sharp from the near foreground out to infinity, without needing to stop down further than necessary.

Portrait photography

A wide aperture and closer subject distance narrows depth of field deliberately, so the subject stands out sharply against a blurred background.

Choosing an aperture for a group shot

Working out the near and far limits at a candidate aperture checks whether everyone in a row, at slightly different distances from the camera, will fall within the sharp zone.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How depth of field changes with aperture at a fixed focal length and distance

A fixed 50mm lens and 5-metre subject distance, across a range of apertures.

50mm lens, full-frame sensor, subject at 5 metres
Aperture (f-stop)Near focus limitFar focus limitTotal depth of field
f/2.84.29 m6.00 m1.71 m
f/44.04 m6.55 m2.51 m
f/5.63.76 m7.48 m3.72 m
f/83.39 m9.49 m6.09 m
f/113.03 m14.25 m11.22 m
f/162.58 m85.27 m82.69 m
Depth of field widens as the aperture narrows (a higher f-number), since a smaller aperture reduces the size of the blur circle at any given distance from the point of focus.

How depth of field changes with subject distance at a fixed focal length and aperture

A fixed 50mm lens at f/8, across a range of subject distances.

50mm lens at f/8, full-frame sensor
Subject distanceNear focus limitFar focus limitTotal depth of field
1 m0.92 m1.10 m0.18 m
2 m1.69 m2.46 m0.77 m
3 m2.34 m4.18 m1.84 m
5 m3.39 m9.49 m6.09 m
8 m4.55 m33.27 m28.72 m
12 m5.60 m
Depth of field widens rapidly as the subject moves further away, and the far limit reaches infinity once the subject distance reaches the hyperfocal distance for that focal length and aperture.

Questions

What is the circle of confusion, and why does sensor size matter?

It is the largest blur spot on the sensor that still appears as a sharp point once the image is viewed at a normal size. A larger sensor is normally viewed at greater enlargement for the same output size, so it needs a stricter (larger) circle of confusion, which is why full-frame and Micro Four Thirds cameras produce different depth of field at the same aperture and framing.

Why does a longer lens give shallower depth of field?

Focal length appears squared in the hyperfocal distance formula, so a longer lens produces a much larger hyperfocal distance, which narrows the near-to-far sharp zone at any given subject distance compared with a wider lens.

What happens if the subject distance equals the hyperfocal distance?

The far limit becomes infinity: everything from half the hyperfocal distance out to infinity is within the depth of field. This is the basis of the classic landscape technique of focusing at the hyperfocal distance rather than at infinity itself.

Does depth of field depend on how the final image is viewed?

Yes, indirectly, through the circle of confusion. A larger final print or a closer viewing distance effectively demands a stricter circle of confusion, which this calculator does not adjust for beyond the standard per-format values used here.

To work out the field of view a given focal length actually produces on a cropped sensor, see the crop factor calculator.