Calculate the "depth that looks in focus" in a photograph. Adjust the focal length, f-number, subject distance and sensor format to see the depth of field (DOF), hyperfocal distance, near limit and far limit update in real time, and design exactly the bokeh or pan-focus you want.
Parameters
Focal length f
mm
Lens focal length. A longer lens gives a shallower depth of field
F-number F
A larger f-number (stopping down) gives a deeper depth of field
Subject distance s
m
Distance from the camera to the focused subject
Sensor format
Sets the circle of confusion CoC
Results
—
Hyperfocal distance H (m)
—
Near limit Dn (m)
—
Far limit Df (m)
—
Depth of field DOF (m)
—
Front depth fraction (%)
—
Depth verdict
—
Depth-of-field scene — in-focus zone
A camera on the left and a distance scale show the focused subject and the "sharp zone" (near limit Dn to far limit Df). Objects outside the zone are drawn blurred, and the hyperfocal distance H is marked on the scale.
Depth of field vs f-number
Near & far limit vs subject distance
Theory & Key Formulas
$$H=\frac{f^2}{N\,c}+f$$
Hyperfocal distance H. f: focal length, N: f-number, c: circle of confusion. Focus beyond this distance and the far limit reaches infinity.
Near limit Dn and far limit Df. s: subject distance. c is the circle of confusion set by the sensor size, and the far limit goes to infinity once the subject reaches the hyperfocal distance. Depth of field is DOF = Df − Dn.
What is Depth of Field?
🙋
"Depth of field" comes up a lot in photography, but what is it really? You focus on just one spot, don't you?
🎓
Good question. Roughly speaking, it is the "thickness of the zone that looks in focus". It's true the lens forms a perfectly sharp image on only one plane, but in front of and behind it there is a range where the blur is small enough to still read as a point. The front edge is the near limit, the back edge is the far limit, and the distance between them is the depth of field. With this tool's defaults, the near limit is 2.5 m, the far limit 3.7 m, so the depth is about 1.2 m.
🙋
"Blur small enough to read as a point" — who decides that? It sounds like it would vary from person to person.
🎓
That is the "circle of confusion (CoC)". It is the threshold size: if a point blurs into a circle smaller than this, we agree to call it a point. Assuming you make the same-sized print, a smaller sensor has to be enlarged more, so the acceptable blur shrinks too. That is why changing the "Sensor format" on the left changes the CoC and shifts the whole depth-of-field result. It's about 0.029 mm for full-frame and 0.011 mm for 1-inch.
🙋
I see. So when I want to softly blur the background, what should I change?
🎓
Make the depth of field "shallow". Three ways: open the aperture (smaller f-number), use a longer focal length, or move closer to the subject. On the "Depth of field vs f-number" chart below, push the f-number toward 1 and you will see the DOF collapse sharply. The classic portrait recipe "85 mm at f/1.8, move in close" works because it pushes all three levers in the bokeh direction.
🙋
And the opposite — landscapes where I want everything from front to back tack-sharp?
🎓
That is where the "hyperfocal distance" comes in. Focus at the value H shown in the results, and everything from half of it (H/2) to infinity is rendered sharp. That is pan-focus. With the defaults H is about 15.4 m, so focusing there makes everything from 7.7 m onward sharp. For landscapes you also stop down to f/8-f/11 to pull H closer.
🙋
The results also show a "front depth fraction". Isn't the depth the same in front and behind the focus point?
🎓
Right, this is a common misconception. The depth of field is not symmetric. Roughly one-third extends in front of the subject and two-thirds behind. So for a group photo where you want everyone sharp, focus not on the front row but on someone about a third of the way back. Even at the defaults the front share is about 40%, so you can see the rear side is wider.
Frequently Asked Questions
Depth of field (DOF) is the range of subject distances, in front of and behind the focused subject, that appear acceptably sharp. A lens forms a perfectly sharp image on only one focal plane, but in front of and behind it there is a zone where the blur stays smaller than the circle of confusion, so the human eye still perceives it as in focus. The distance from the near limit to the far limit is the depth of field, set by the aperture, focal length, subject distance and sensor size.
The circle of confusion is the largest blurred image of a point that can still be regarded as a point. Assuming you view the final print or screen at the same size, a smaller sensor must be enlarged more, so the blur acceptable on the sensor becomes smaller. Typical values are about 0.029 mm for full-frame, 0.019 mm for APS-C, 0.015 mm for Micro Four Thirds and 0.011 mm for 1-inch. The smaller the CoC, the stricter the sharpness criterion and the narrower the calculated DOF.
When you focus at the hyperfocal distance H, everything from half of it (H/2) to infinity is rendered acceptably sharp and the depth of field is maximised. This is the standard technique for landscape photography when you want a foreground flower and a distant mountain sharp at the same time (pan-focus). This tool calculates and displays the hyperfocal distance H, so focusing there gives you the maximum possible DOF.
A shallow depth of field blurs the background strongly. There are three ways: (1) open the aperture (use a smaller f-number), (2) use a lens with a longer focal length, and (3) move closer to the subject. To melt the background in a portrait, a classic combination is 85 mm at f/1.8 while moving in close. For group shots or landscapes, do the opposite: stop down (f/8-f/11) and use a shorter focal length to widen the DOF.
Real-World Applications
Portrait photography: When a person is the subject, the background is melted into a smooth blur to make the subject stand out. A short-telephoto lens around 85 mm is used wide open (f/1.4-f/2.8) close to the subject, narrowing the depth of field to a matter of centimetres. But too shallow and the eyes are sharp while the nose and ears fall outside; this tool lets you check the near and far limits and confirm in advance that the DOF covers the depth of the face.
Landscape and architecture: When you want everything from a foreground to distant mountains sharp, pan-focus using the hyperfocal distance is the basic technique. Stop a wide-angle lens down to f/8-f/11 and focus at the calculated hyperfocal distance H, and everything from H/2 to infinity falls within the acceptable range. This tool computes H instantly from focal length and aperture, giving you a focusing target on location.
Macro and product shots: When shooting flowers, insects or products extremely close, the depth of field shrinks to millimetres. You stop down to get the whole subject in focus, but stopping down too far loses resolution to diffraction. With this tool you can check the DOF and find an f-number that balances the depth you need against diffraction. If the depth of field is still insufficient, it also helps you decide to switch to focus stacking — combining several frames shot at shifted focus.
Machine vision and industrial cameras: In factory visual inspection and dimensional measurement, the variation in the height and position of inspected objects must all fall within the acceptable DOF. Designing depth of field from the lens focal length, aperture, working distance and sensor size is exactly the same optical calculation as in photography. Near/far focus calculations like this tool feed directly into the lighting design and lens selection of an inspection line.
Common Misconceptions and Pitfalls
The most common belief is that stopping down ever further makes the whole image sharper. A larger f-number does deepen the depth of field, but at f/16 or f/22 another effect — diffraction — takes over. As light passes through the small aperture opening it spreads as a wave, and the resolution of the focal plane itself drops. Most lenses are sharpest around f/5.6-f/8; stopping down further widens the DOF but lowers the overall sharpness of the image. The DOF this tool reports is the "in-focus range based on the circle of confusion" and does not include the resolution loss from diffraction. Treat a deep DOF and high resolution as a trade-off.
Next, the misconception that depth of field extends symmetrically in front of and behind the subject. In reality the near side (front) is roughly one-third and the far side (rear) roughly two-thirds — the rear is wider. The closer the subject gets to the hyperfocal distance, the more extreme this asymmetry becomes, until finally the far limit jumps to infinity. For a group photo where you want everyone sharp, focus on the row a third of the way back rather than the front row; for a landscape, focus a little beyond the nearest rock rather than on it. The "front depth fraction" in this tool shows that bias as a number.
Finally, the misconception that the circle of confusion is a fixed physical constant. CoC is not a value uniquely fixed by physical law; it is an engineering convention that depends on the human-side conditions of "at what size and from what distance the image is finally viewed". The preset values in this tool (0.029 mm for full-frame, etc.) are merely representative figures for a standard print size and viewing distance. For prints enlarged greatly and viewed up close, a stricter (smaller) CoC should be used, and then the depth of field is narrower than the calculated value for the same lens settings. Treat the DOF figure not as an absolute value but as a guide to be interpreted together with the viewing conditions.
How to Use
Set focal length (mm) using flNum slider: typical range 24–400mm for crop/full-frame sensors
Enter f-number (fnNum): lower values (f/1.4–f/2.8) produce shallow DoF; higher values (f/16–f/22) extend depth
Specify subject distance (sdNum) in meters: critical parameter affecting near and far focus limits
Select sensor format via dropdown: Full Frame (36×24mm) yields shallower DoF than APS-C (23.6×15.7mm) at identical settings
Read output: hyperfocal distance H, near limit Dn, far limit Df, total DoF span, and front depth fraction percentage
Worked Example
Portrait shot on full-frame camera: focal length 85mm, f/1.8, subject at 1.5m distance, circle of confusion 0.03mm. Simulator returns: hyperfocal H=41.67m, near limit Dn=1.47m, far limit Df=1.54m, DoF=0.07m (70mm sharp zone). Adjusting to f/5.6 at same distance increases DoF to 0.68m, shifting near/far limits to 1.10m and 1.78m respectively. Landscape mode: 35mm focal length, f/8, subject 3m away yields DoF=6.2m with near limit 1.8m and far limit 8.0m.
Practical Notes
Hyperfocal distance H represents the nearest focus point where infinity remains acceptably sharp; focus here to maximize DoF in landscapes
Front depth fraction shows asymmetry: at close range, sharp zone extends more behind subject than in front, critical for product photography
Sensor format dominates micro-DoF work: full-frame at f/2.8 produces 0.15m DoF versus APS-C yielding 0.24m at identical settings and distance
Macro work (subject <0.3m) requires stopped-down aperture; f/16 yields only 5–8mm DoF even on crop sensors
Video cinema applications: maintain subject distance consistency; 1cm shift at 0.5m focus distance can move subject outside DoF zone