Depth of Field Calculator
Pick your sensor, focal length, f-number and distance. Drag the subject along the scale and watch the sharp zone move.
https://flxcode.com/depth-of-field-calculator/
Distance from the camera to the subject you focus on. Arrow keys in the f-number box step one third of a stop.
Camera to subject, log scale Drag the round marker, or focus it and use the arrow keys.
Show the working
Same picture on another sensor
| Sensor | Crop | Focal length | F-number | Depth of field |
|---|
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it. What this tool keeps and sends.
Problem or idea? Email us
How to use it
- Pick the sensor of your camera. The circle of confusion is set from it. Choose Other to type a sensor size in mm.
- Type the focal length in mm, choose or type the f-number, and type the distance to what you focus on.
- Read the near limit, the far limit and the hyperfocal distance. Drag the round marker in the diagram to try other distances.
- Turn on Compare two settings to put, for example, f/1.8 and f/8 next to each other.
The page remembers your sensor and your unit, metres or feet, on this device. The numbers you type are not stored and not sent.
The formulas
The tool uses the thin-lens formulas with the focal length f, the f-number N, the circle of confusion c and the focus distance s, all in the same unit.
- Hyperfocal distance: H = f² ÷ (N × c) + f
- Near limit: s × (H − f) ÷ (H + s − 2f)
- Far limit: s × (H − f) ÷ (H − s), for s below H. At or beyond H it is infinity.
- Depth of field: far limit minus near limit. In front of the subject: s minus near. Behind: far minus s.
- Focused at H, the near limit is H ÷ 2.
The Wikipedia article on hyperfocal distance gives H with the same worked example we use for a check: 50 mm, f/8 and c = 0.03 mm give 10467 mm. With the tool's default c = 0.0288 mm, the near and far limits at 5 m are 3.43 m and 9.21 m, depth 5.77 m, with 1.57 m in front and 4.21 m behind. The formulas are in the depth of field article, which cites Ray, Applied Photographic Optics.
Where the circle of confusion comes from
A point that is out of focus becomes a small disc on the sensor. If the disc is small enough, the eye reads it as a point. That size limit is the circle of confusion, c. It depends on how the picture is viewed, so there is no single true value.
The old full-frame figure comes from a print viewed at 25 cm. The eye resolves about 0.2 mm there, and a 35 mm frame enlarged to 25 cm on the long side is magnified about 7 times, so 0.2 ÷ 7 ≈ 0.029 mm, as in the Wikipedia article on the circle of confusion, which also says that d ÷ 1500 is a widely used limit and that 0.030 mm and 0.033 mm are common for full frame. For a full frame sensor the diagonal d is 43.27 mm, so d ÷ 1500 = 0.0288 mm. Other formats use their own diagonal.
| Sensor | Size (mm) | Diagonal (mm) | Crop factor | c = d ÷ 1500 (mm) |
|---|---|---|---|---|
| Full frame | 36 × 24 | 43.27 | 1 | 0.0288 |
| APS-C Canon | 22.3 × 14.9 | 26.82 | 1.61 | 0.0179 |
| APS-C Nikon, Sony, Fuji | 23.5 × 15.6 | 28.21 | 1.53 | 0.0188 |
| Micro Four Thirds | 17.3 × 13 | 21.64 | 2 | 0.0144 |
| 1-inch | 13.2 × 8.8 | 15.86 | 2.73 | 0.0106 |
| Medium format 44 × 33 | 44 × 33 | 55 | 0.79 | 0.0367 |
Sensor sizes are nominal and vary a little by model. A tenth of a millimetre moves c by well under 1%. Phone cameras are not listed because their sensor sizes are not stated in a source we can cite. Choose Other and type the size if you know it.
Worked examples
| Situation (full frame, c = 0.0288 mm) | Near | Far | Depth |
|---|---|---|---|
| Portrait, 85 mm f/1.8 at 3 m | 2.94 m | 3.06 m | 0.13 m |
| Same portrait at f/8 | 2.74 m | 3.31 m | 0.56 m |
| Landscape, 24 mm f/11 at 2 m | 0.96 m | ∞ | ∞ |
| Landscape, 24 mm f/11 focused at its hyperfocal distance of 1.84 m | 0.92 m | ∞ | ∞ |
Hyperfocal distance on full frame
Focus at this distance and everything from half of it to infinity passes. Values in metres, c = 0.0288 mm.
| Focal length | f/2.8 | f/5.6 | f/8 | f/11 | f/16 |
|---|---|---|---|---|---|
| 24 mm | 7.16 m | 3.59 m | 2.52 m | 1.84 m | 1.27 m |
| 35 mm | 15.2 m | 7.62 m | 5.34 m | 3.9 m | 2.69 m |
| 50 mm | 31 m | 15.53 m | 10.88 m | 7.93 m | 5.47 m |
| 85 mm | 89.54 m | 44.81 m | 31.4 m | 22.86 m | 15.74 m |
| 135 mm | 225.79 m | 112.96 m | 79.11 m | 57.57 m | 39.62 m |
Same picture on other sensors
To get the same view and the same depth of field on a smaller sensor, multiply the focal length and the f-number by the ratio of the diagonals. The circle of confusion scales the same way, which is what d ÷ 1500 does. Starting from 50 mm f/8 at 5 m on full frame:
| Sensor | Focal length | F-number | Depth |
|---|---|---|---|
| Full frame | 50 mm | f/8 | 5.77 m |
| APS-C Canon | 31 mm | f/5 | 5.81 m |
| APS-C Nikon, Sony, Fuji | 32.6 mm | f/5.2 | 5.81 m |
| Micro Four Thirds | 25 mm | f/4 | 5.82 m |
| 1-inch | 18.3 mm | f/2.9 | 5.83 m |
| Medium format 44 × 33 | 63.6 mm | f/10.2 | 5.75 m |
The depth differs by a hair between rows because the formula has a small extra term, the + f in H. The tool shows the same table for your own settings.
Limits
- Thin-lens approximation. Real lenses have thick elements, and the focus distance is measured from a point inside the lens that the manufacturer does not give you.
- Not for macro. Close to the lens, depth depends on magnification, not on the distance alone.
- The circle of confusion is an assumption about how the picture is viewed. A different print size or a heavy crop needs a different value.
- Diffraction is not included. Small apertures such as f/22 add their own blur on high resolution sensors, so the sharpest result is not always at the highest f-number.
- The diagram covers 0.2 m to 200 m. You can type distances outside it, and the numbers are still right, but the marker stops at the edge.
- f-numbers use the values printed on lenses, such as 5.6 and 11, not the exact powers of the square root of 2.
FAQ
What is depth of field?
The range of distances that look acceptably sharp in the picture. You focus on one distance only. Things nearer or farther get blurrier, and depth of field is the stretch where that blur is still too small to see. For 50 mm at f/8 focused on 5 m on a full frame camera it runs from 3.43 m to 9.21 m, using the tool's default circle of confusion of 0.0288 mm.
What circle of confusion should I use?
The default is the sensor diagonal divided by 1500. On full frame that is 0.0288 mm, which most tables round to 0.029 mm, and 0.030 mm is also common. It is a viewing assumption, not a property of your lens. If you print big or crop a lot, use a smaller value. You can type your own.
What is hyperfocal distance?
The closest focus distance at which the far limit reaches infinity. Focus there and everything from half that distance to infinity is acceptably sharp. For 50 mm at f/8 on full frame it is 10.88 m with the default 0.0288 mm circle. The tool shows it with every result.
Why does my far limit say infinity?
Your subject is at or beyond the hyperfocal distance. Past that point the formula has no finite far limit. Everything from the near limit out to the horizon passes the sharpness test.
Does a smaller sensor give more depth of field?
With the same lens, f-number and distance it gives less, because the circle of confusion shrinks with the sensor. But you do not use the same lens. For the same view you use a shorter one. On APS-C, 32.6 mm f/8 frames like 50 mm f/8 on full frame and has 2.4 times the depth. To match full frame, open the lens to f/5.2 instead of keeping f/8. The table on this page does that conversion.
Does focal length change depth of field?
At a fixed subject distance, a longer lens has less. Standing at 5 m, 100 mm f/8 gives 1.15 m of depth against 5.77 m for 50 mm f/8 (both with c = 0.0288 mm). If you move back to keep the subject the same size, the difference mostly disappears.
More from FLXCode
- View EXIF DataSee the camera, date, GPS and other metadata inside a JPG, PNG, WebP, HEIC or TIFF file. Nothing is uploaded.
- Aspect Ratio CalculatorSimplify width and height to a ratio, find the missing side, fit or fill a box, and get screen size from the diagonal.
- Change Image DPISet the dpi of a JPG or PNG without touching the pixels, or resample to a print size. Nothing is uploaded.
- Ratio CalculatorSolve A:B = C:D, simplify a ratio, split a total in a ratio, or turn a ratio into percents.