DOF CALCULATOR
Depth-of-Field Calculator
NS 2.0 MSIE 3.0 or later Required
First a brief review of depth of field…
(or skip this and go to the calculator)
Depth of field (DOF) is the range of distances in an image over which the image is said to be «sharp». In actuality, only one plane of the image can actually be in focus, but all points lying within the DOF are considered to be «acceptably» sharp. A critical concept in DOF is the diameter of the circle of confusion (CoC). A point in the image which is actually in focus will have a typical diameter in the image plane (diffraction limited spot size) in the 5 to 10 micron range. Points lying at the limits of the DOF will image with a diameter equal to the circle of confusion diameter (by definition). For 35mm work this is typically taken to be around 30 microns and this is based on the appearance of a standard sized print at a standard viewing distance. While the «standard» is rarely explicitly defined, it seems to be close to an 8×10 print viewed from about 1 foot.
Here’s an attempt at a graphical explanation of what’s involved:
In the diagrams above the black lines represent light rays from a subject that is in focus. Light is focused onto the focal plane (shown in green) to a small spot. The red lines represent a point that’s further from the lens. Light rays from this point come to a focus in front of the focal plane, and by the time they intersect the focal plane they’ve diverged to form a larger spot who’s size is defined by how far apart the red lines are when they cross the green focal plane.
The blue lines represent light from a point closer to the lens. These lines cross (focus) at a point that’s behind the focal plane. When they cross the (green) focal plane they form a spot who’s size is defined by how far apart they are when they cross.
It should be evident from the figure that the size of spots formed by the red and blue rays are smaller in the lower figure (representing a smaller aperture) than in the upper figure (representing a larger aperture). If the spots are smaller then the circle of confusion value, we can say that the red and blue rays come from points within the depth of field of the lens.
Thus in the upper figure with the larger aperture the red and blue points may lie outside the DOF, but in the lower figure they may lie inside. This is why stopping down gives you a greater depth of field/
It’s important to note that DOF isn’t a lens characteristic like focal length or aperture. It takes into account some subjective factors like print size and viewing distance. That’s the reason different values for the CoC are used for different formats. Larger formats need to be enlarged less than smaller formats, and so a larger CoC can be used. For example to get an 8×10 print from an 8×10 negative, no enlargement is required, wheras to get the same print from a 35mm negative, an 8x enlargement is needed. So to get the same sharpness in a print, the 35mm negative must be 8x as sharp, or in terms of DOF and CoC, the CoC value used for DOF calculation must be 8x smaller.
From this I think you can see that if you’re concerned about an 8×10 print which will be viewed from a distance of 3 ft, rather than 1ft, you could use a different CoC (one 3x as large in fact), wheras if you’re concerned about a 24×30 print viewed from a distance of 1ft, the CoC value you need to use is 3x smaller than the «standard» value
DOF is at best a «fuzzy» concept, depending on subjective judgement of what appears to be sharp. While claculations may give number to 16 decimal places, those numbers are based on «fuzzy» assumptions. So when a DOF calculation tells you the far point in focus is at 17.35567423 feet, what that really means is that stuff that’s maybe 16-17ft from the camera shouldn’t look too soft. It doesn’t mean an object at 17.35567422 ft from the camera will be razor sharp and stuff that’s 17.35567424 ft from the camera will be blurred.
Note that traditional DOF calculations such as this one are based on simple geometric optics neglecting diffraction effects. Diffraction effects make the smallest possible focused point (diffraction limited spot size) larger than zero. In fact at f32, the diffraction limited spot size is around 40 microns. Clearly using a circle of confusion value of 30 microns (10 microns smaller than the smallest possible focused spot!) is rather meaningless. The correct way to estimate DOF would be to use a defocus MTF approach. This isn’t too hard but does involve the use of things like Bessel functions which most photographers wouldn’t be too comfortable with! The simple approximation is good enough when the diffraction limited spot size is significantly smaller than the circle of confusion. The diffraction limited spot size is approximately [1.25 x fstop] microns.
The hyperfocal distance is that distance at which infinity will lie just inside the depth of field. When a lens is focused at the hyperfocal distance everything from infinity to 1/2 the hyperfocal distance will lie within the depth of field (i.e. will be «acceptably» sharp»
Note that the notion of «acceptably» sharp depends on the viewer, so it is a subjective quality of the image. What’s «acceptable» to you may not be «acceptable» to me – and vice versa.
The Calculator
To find the near, far and hyperfocal distance for a specific lens, enter the focal length (mm), aperture (f/number) and the object distance. The JavaScript program will calculate the near point in focus, far point in focus, depth of focus and hyperfocal distance. The default unit of measure for distance is feet. This can be overridden by selecting meters.
The basic Javascript source for this DOF calculator was written by Michael C Gillett and thanks are due to him for making the code available for non-commercial use. The code used here is slightly modified to include digital sensors
The following values are used for the circle of confusion diameter:
? 35mm – 30 microns
? 1.3x DSLR (EOS 1D) – 23 microns
? 1.5x DSLR (D100) – 20 microns
? 1.6x DSLR (EOS 10D) 18.75 microns
? 2x DSLR (E-1) 15 microns
? 645 – 50 microns
? 6×6 – 60 microns
? 6×7 – 65 microns
? 6×9 – 75 microns
? 4×5 – 150 microns
? 5×7 – 200 microns
? 8×10 – 300 microns
Notes: (1) 1 micron = 0.001mm. (2) Depth of field calculations only involve focal length, distance and the value chosen for circle of confusion and do not include format. Format is only involved insofar as it’s a factor in choosing the circle of confusion value. So, for example, if you’re shooting 6×7 but prefer to base your calculations on a circle of confusion value of 50 microns rather than 65 microns, just use the values calculated here for 645
NEW – I’ve just posted a stand-alone optical calculator which you can download and run under Windows. It calculates near and far points in focus, hyperfocal distance, background blur, resolution and spot size.
Please see this page – Optical Calculator
© Copyright Bob Atkins All Rights Reserved
www.bobatkins.com
Last Modified 11/06/2010 07:06:57
Hyperfocal distance, near distance of acceptable sharpness, and far distance of acceptable sharpness are calculated using the following equations (from Greenleaf, Allen R., Photographic Optics, The MacMillan Company, New York, 1950, pp. 25-27):
where:
H is the hyperfocal distance, mm
f is the lens focal length, mm
s is the focus distance
Dn is the near distance for acceptable sharpness
Df is the far distance for acceptable sharpness
N is the f-number
c is the circle of confusion, mm
f-number is calculated by the definition N = 2i/2 , where i = 1, 2, 3,… for f/1.4, f/2, f/2.8,…
The depth of field does not abruptly change from sharp to unsharp, but instead occurs as a gradual transition. In fact, everything immediately in front of or in back of the focusing distance begins to lose sharpness– even if this is not perceived by our eyes or by the resolution of the camera.
CIRCLE OF CONFUSION
Since there is no critical point of transition, a more rigorous term called the «circle of confusion» is used to define how much a point needs to be blurred in order to be perceived as unsharp. When the circle of confusion becomes perceptible to our eyes, this region is said to be outside the depth of field and thus no longer «acceptably sharp.» The circle of confusion above has been exaggerated for clarity; in reality this would be only a tiny fraction of the camera sensor’s area.
When does the circle of confusion become perceptible to our eyes? An acceptably sharp circle of confusion is loosely defined as one which would go unnoticed when enlarged to a standard 8×10 inch print, and observed from a standard viewing distance of about 1 foot.
At this viewing distance and print size, camera manufactures assume a circle of confusion is negligible if no larger than 0.01 inches (when enlarged). As a result, camera manufacturers use the 0.01 inch standard when providing lens depth of field markers (shown below for f/22 on a 50mm lens). In reality, a person with 20-20 vision or better can distinguish features 1/3 this size or smaller, and so the circle of confusion has to be even smaller than this to achieve acceptable sharpness throughout.
A different maximum circle of confusion also applies for each print size and viewing distance combination. In the earlier example of blurred dots, the circle of confusion is actually smaller than the resolution of your screen for the two dots on either side of the focal point, and so these are considered within the depth of field. Alternatively, the depth of field can be based on when the circle of confusion becomes larger than the size of your digital camera’s pixels.
Note that depth of field only sets a maximum value for the circle of confusion, and does not describe what happens to regions once they become out of focus. These regions also called «bokeh,» from Japanese (pronounced bo-k?). Two images with identical depth of field may have significantly different bokeh, as this depends on the shape of the lens diaphragm. In reality, the circle of confusion is usually not actually a circle, but is only approximated as such when it is very small. When it becomes large, most lenses will render it as a polygonal shape with 5-8 sides.
CONTROLLING DEPTH OF FIELD
Although print size and viewing distance are important factors which influence how large the circle of confusion appears to our eyes, aperture and focal distance are the two main factors that determine how big the circle of confusion will be on your camera’s sensor. Larger apertures (smaller F-stop number) and closer focal distances produce a shallower depth of field. The following depth of field test was taken with the same focus distance and a 200 mm lens (320 mm field of view on a 35 mm camera), but with various apertures:
f/8.0 f/5.6 f/2.8
CLARIFICATION: FOCAL LENGTH AND DEPTH OF FIELD
Note that I did not mention focal length as influencing depth of field. Even though telephoto lenses appear to create a much shallower depth of field, this is mainly because they are often used to make the subject appear bigger when one is unable to get closer. If the subject occupies the same fraction of the image (constant magnification) for both a telephoto and a wide angle lens, the total depth of field is virtually* constant with focal length! This would of course require you to either get much closer with a wide angle lens or much further with a telephoto lens, as demonstrated in the following chart:
Focal Length (mm) Focus Distance (m) Depth of Field (m)
10 0.5 0.482
20 1.0 0.421
50 2.5 0.406
100 5.0 0.404
200 10 0.404
400 20 0.404
Note: Depth of field calculations are at f/4.0 on a Canon EOS 30D (1.6X crop factor),
using a circle of confusion of 0.0206 mm.
Note how there is indeed a subtle change for the smallest focal lengths. This is a real effect, but is negligible compared to both aperture and focus distance. Even though the total depth of field is virtually constant, the fraction of the depth of field which is in front of and behind the focus distance does change with focal length, as demonstrated below:
Distribution of the Depth of Field
Focal Length (mm) Rear Front
10 70.2 % 29.8 %
20 60.1 % 39.9 %
50 54.0 % 46.0 %
100 52.0 % 48.0 %
200 51.0 % 49.0 %
400 50.5 % 49.5 %
This exposes a limitation of the traditional DoF concept: it only accounts for the total DoF and not its distribution around the focal plane, even though both may contribute to the perception of sharpness. A wide angle lens provides a more gradually fading DoF behind the focal plane than in front, which is important for traditional landscape photographs.
On the other hand, when standing in the same place and focusing on a subject at the same distance, a longer focal length lens will have a shallower depth of field (even though the pictures will show something entirely different). This is more representative of everyday use, but is an effect due to higher magnification, not focal length. Longer focal lengths also appear to have a shallow depth of field because they flatten perspective. This renders a background much larger relative to the foreground– even if no more detail is resolved. Depth of field also appears shallower for SLR cameras than for compact digital cameras, because SLR cameras require a longer focal length to achieve the same field of view.
*Note: We describe depth of field as being virtually constant because there are limiting cases where this does not hold true. For focal distances resulting in high magnification, or very near the hyperfocal distance, wide angle lenses may provide a greater DoF than telephoto lenses. On the other hand, for situations of high magnification the traditional DoF calculation becomes inaccurate due to another factor: pupil magnification. This actually acts to offset the DoF advantage for most wide angle lenses, and increase it for telephoto and macro lenses. At the other limiting case, near the hyperfocal distance, the increase in DoF arises because the wide angle lens has a greater rear DoF, and can thus more easily attain critical sharpness at infinity for any given focal distance.
CALCULATING DEPTH OF FIELD
In order to calculate the depth of field, one needs to first decide on an appropriate value for the maximum allowable circle of confusion. This is based on both the camera type (sensor or film size), and on the viewing distance / print size combination.
Depth of field calculations ordinarily assume that a feature size of 0.01 inches is required for acceptable sharpness (as discussed earlier), however people with 20-20 vision can see features 1/3 this size. If you use the 0.01 inch standard of eyesight, understand that the edge of the depth of field may not appear acceptably sharp. The depth of field calculator below assumes this standard of eyesight, however I also provide a more flexible depth of field calculator.
Depth of Field Calculator
Camera Type
Selected aperture
Actual lens focal length mm
Focus distance (to subject) meters
Closest distance of acceptable sharpness
Furthest distance of acceptable sharpness
Total Depth of Field
Note: CF = «crop factor» (commonly referred to as the focal length multiplier)
DEPTH OF FOCUS & APERTURE VISUALIZATION
Another implication of the circle of confusion is the concept of depth of focus (also called the «focus spread»). It differs from depth of field in that it describes the distance over which light is focused at the camera’s sensor, as opposed to how much of the subject is in focus. This is important because it sets tolerances on how flat/level the camera’s film or digital sensor have to be in order to capture proper focus in all regions of the image.
Diagram depicting depth of focus versus camera aperture. The purple lines represent the extreme angles at which light could potentially enter the aperture. The purple shaded in portion represents all other possible angles. Diagram can also be used to illustrate depth of field, but in that case it’s the lens elements that move instead of the sensor.
The key concept is this: when an object is in focus, light rays originating from that point converge at a point on the camera’s sensor. If the light rays hit the sensor at slightly different locations (arriving at a disc instead of a point), then this object will be rendered as out of focus — and increasingly so depending on how far apart the light rays are.
OTHER NOTES
Why not just use the smallest aperture (largest number) to achieve the best possible depth of field? Other than the fact that this may require prohibitively long shutter speeds without a camera tripod, too small of an aperture softens the image by creating a larger circle of confusion (or «Airy disk») due to an effect called diffraction– even within the plane of focus. Diffraction quickly becomes more of a limiting factor than depth of field as the aperture gets smaller. Despite their extreme depth of field, this is also why «pinhole cameras» have limited resolution.
For macro photography (high magnification), the depth of field is actually influenced by another factor: pupil magnification. This is equal to one for lenses which are internally symmetric, although for wide angle and telephoto lenses this is greater or less than one, respectively. A greater depth of field is achieved (than would be ordinarily calculated) for a pupil magnification less than one, whereas the pupil magnification does not change the calculation when it is equal to one. The problem is that the pupil magnification is usually not provided by lens manufacturers, and one can only roughly estimate it visually.

