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
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.
| Term | Meaning |
|---|---|
| Hyperfocal distance | The focus distance beyond which everything to infinity is acceptably sharp, at a given focal length and aperture. |
| Circle of confusion | The largest blur spot on the sensor that still looks like a sharp point, a fixed published value per sensor format. |
| Near / far limit | The closest and furthest points from the camera that remain within acceptable sharpness for the focused subject. |
The inputs explained
| Field | What 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 format | The 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.
| Aperture (f-stop) | Near focus limit | Far focus limit | Total depth of field |
|---|---|---|---|
| f/2.8 | 4.29 m | 6.00 m | 1.71 m |
| f/4 | 4.04 m | 6.55 m | 2.51 m |
| f/5.6 | 3.76 m | 7.48 m | 3.72 m |
| f/8 | 3.39 m | 9.49 m | 6.09 m |
| f/11 | 3.03 m | 14.25 m | 11.22 m |
| f/16 | 2.58 m | 85.27 m | 82.69 m |
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.
| Subject distance | Near focus limit | Far focus limit | Total depth of field |
|---|---|---|---|
| 1 m | 0.92 m | 1.10 m | 0.18 m |
| 2 m | 1.69 m | 2.46 m | 0.77 m |
| 3 m | 2.34 m | 4.18 m | 1.84 m |
| 5 m | 3.39 m | 9.49 m | 6.09 m |
| 8 m | 4.55 m | 33.27 m | 28.72 m |
| 12 m | 5.60 m | ∞ | ∞ |
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.