The Mathematics of Depth of Field

by Paul Skoczylas | October 1, 2004

© Paul SkoczylasThere has been lots of discussion recently in the and other internet forums about depth of field (DOF) and what affects it. Depth of field is of particular interest when comparing standard 35mm cameras with digital cameras, which have a sensor smaller than 35mm film’s 24mm x 36mm frame.

As an engineer, I have an interest in the equations describing physical phenomena, so I decided to have a look at the equations for depth of field. Before I get into what I found, let me state some assumptions and other clarifications.

  1. I did not derive these equations myself. I found them on the internet (some web pages listed later). One of the pages provided a reference book, which I have not read. Therefore, I cannot state for certain what assumptions are implicit in the equations, but I can give you a good idea. I also found other websites (not listed here to protect the guilty) which gave equations for DOF which did not agree with the ones I use here. In fact, some gave very different results. I do not know if they were incorrect, or if I applied them incorrectly. I will presume, however, that the equations I give here are correct, since several resources listed them independently.
  2. It is my understanding that these equations are derived based upon an idealized lens. Real lenses are somewhat more complicated, as the refraction does not occur at a single plane. Therefore, I would not trust these equations to be valid in any macro application, or in any application where the distance to the subject is not very large relative to the focal length of the lens.
  3. Any statements in this article are related only to depth of field. In the real world, there are other factors which will affect sharpness but they are not considered here. This means that in a case where these equations predict a sharper image, a sharper image might not really occur in reality. Some of these factors could be:
  • Lens quality
  • Lens stability
  • Film or sensor resolution
  • We’re dealing with a “normal” camera/lens, and not a view camera or any other camera/lens with tilt/shift capabilities.

Diffraction (this happens at larger f-stops; meaning that you can’t really stop down to f/1000 and get everything sharp, even though that’s what the equations here will suggest).

The Equations

The point of near focus is:
Point of near focus
The point of far focus is:
Point of far focus
The depth of field is the distance between the points of near and far focus:
Depth of field

The variables are:

  • L – focal length
  • d – maximum acceptable diameter of circle of confusion (more on this later)
  • f – f-stop
  • NF – distance to point of near focus
  • FF – distance to point of far focus
  • D – distance to subject (i.e. distance to point of perfect focus)
  • DOF – difference between FF and NF

I have not provided any units here. The f-stop is a unitless ratio, so you don’t have to worry about it. All the others must be the same, but any unit of length will work (millimeters, inches, feet, meters, miles, furlongs, etc.) We’re used to expressing focal lengths in millimeters, regardless of what we measure other distances in, so I’ll use millimeters in this article. I will, however, convert some results to feet to make life a bit easier. But if I say the DOF for a particular case is 10 feet, that means I calculated it to be 3048 millimeters and just converted, since most of us have a better feel for what 10 feet is than 3048 millimeters.

There’s still one equation of interest. I haven’t given the hyperfocal distance (H) yet. The hyperfocal distance is defined as the point that when focused at, everything from half that distance to infinity is in focus. It is easy to find H from the equations above.

Hyperfocal distance

All of the websites I got these equations from actually list the hyperfocal distance first, and then express NF and FF in terms of H. This makes the equations look simpler, but there’s a good reason that I chose not to do that here. All but one of those websites actually made a simplification to H. They corrected for that in their expressions for NF and FF, so those results end up the same as above, though. It is certainly a valid simplification, though I chose not to include it above: they left the “+” off the end of the expression. For example, a 100mm lens at f/8, with a circle of confusion of 0.03mm, has a hyperfocal distance of 137.03 feet. The simplified version gives 136.70 feet, an error of about 0.2%.

Every photographer knows what focal length and f-stop are. Distance-to-subject should be pretty obvious, too. But what is a circle of confusion? You’ll notice I defined the distance to the subject as the distance to the point of perfect focus. Only objects at that distance are actually in perfect focus. Objects between D and FF and between D and NF only appear to be in focus. The circle of confusion is how we define what we think appears to be in focus. Basically, any point source in the scene being photographed will appear as a fuzzy circle in the image. If that fuzzy circle is small enough, it will appear to our eyes to be a point source, and therefore in focus. The circle of confusion in the above equations is the size of the largest fuzzy circle that still appears to be a sharp point.

Different websites seem to have different ideas as to what the “industry standard” for a maximum acceptable circle of confusion is. For this article, and the examples which follow, I’ll use this rule: the maximum circle of confusion for something to appear in focus is 0.2mm on an 8″ x 10″ print. I’m not going to claim this is a standard of any kind; but it’s the number I will use in the examples below. Now you have to be careful, since to make an 8″ x 10″ from a 35mm slide (or a shot from most digital cameras), you actually have to blow it up to 8″ x 12″ and crop 2 inches off the ends. For a 35mm slide (or negative), the maximum acceptable circle of confusion is then 0.0236mm. (If we had compared the diagonal measurement of the slide to that of an 8″ x 10″, we’d have mistakenly gotten 0.0266mm.) Below, we’ll compare the 35mm slide (24mm x 36mm size) to hypothetical digital cameras with sensors with a 2:3 aspect ratio; 0.6x the size of the 35mm slide (14.4mm x 21.6mm , maximum acceptable circle of confusion is 0.0142mm), and 0.25x the size of the slide (6mm x 9mm, maximum acceptable circle of confusion is 0.00591mm).


First let’s look at the effect of distance and f-stop. In this example, we’ll use a 100mm lens on a 35mm camera. See Figure 1. As distance to the subject increases, DOF increases. As f-stop increases, DOF increases.

DOF in feet to Subject Distance in feet

Figure 1

Now, how about focal length? We’ll choose f/8, and see how the DOF changes with focal length and distance. Again, this will be for the 35 mm film format. See Figure 2. Wide-angle lenses have very large DOF even at small distances. That big 600mm lens, however, at 100 feet, has a DOF of only 3 feet! As focal length increases, DOF decreases.

The last variable in the equations to look at is the size of the circle of confusion. There is no point in comparing different values directly, what we want to know is how sensor size affects DOF. As we decrease the sensor size, we have to blow an image up more to make a print of a given size. This means the acceptable diameter of the circle of confusion on the sensor also gets smaller. (It changes in direct proportion to the sensor/film size.) If we had only changed the size of the circle of confusion, the rule would be: As the maximum acceptable circle of confusion increases, DOF increases. This would make the larger formats look better for DOF. But then we wouldn’t be making a valid comparison, because the images produced will not be the same in each case. In comparing the different sensor/film sizes, I will make the comparison based on the same image content. The image content can be the same only if the camera is in the same place. In order to get the same image content, we will need different focal lengths on each camera. In my opinion this is a better comparison then using the same focal length lenses at different distances to get the same field of view—the field of view may be the same, but the image content will not be. Using the same focal length at the same distance is a trivial comparison—to get the same final image, we’d have to crop from all but the smallest sensor, and we would get exactly the same depth of field in each case.

Figure 2

Figure 2

Figure 3

Figure 3

For comparing the three film/sensor sizes (24mm x 36mm, 14.4mm x 21.6mm, and 6mm x 9mm), I have plotted three cases: a wide angle (50mm lens on 35mm camera; Figure 3), short telephoto (100mm lens on 35mm camera; Figure 4), and long telephoto (500mm lens on 35mm camera; Figure 5). An aperture of f/8 was used in all cases. The focal lengths used to get the same image with each sensor are shown in the legend, along with the maximum acceptable circles of confusion. As sensor/film size increases, DOF decreases.

DOF and Subject distance, feet

Figure 4

Figure 5

Figure 5

We have now have four rules, one for each of the input variables in the DOF equation:

  1. As distance to the subject increases, DOF increases.
  2. As f-stop increases, DOF increases.
  3. As focal length increases, DOF decreases.
  4. As sensor/film size increases, DOF decreases.

It can be shown mathematically that these rules are always true for any valid inputs, when D is significantly larger than L (which was an assumption required to use these equations, as I stated at the top of this article). Note that some of these rules are more important than others—they do not all have the same relative effect on DOF.

In applying these equations, remember that DOF is not the only factor which affects overall image sharpness! Also, remember that some people’s eyes are sharper than others—only the plane of focus is actually sharp; everything else in the calculated DOF only appears to be sharp by an arbitrary criterion. This may not be appropriate for all eyes.


About the Author

Paul Skoczylas lives in Edmonton, Alberta, Canada. He began taking photographs at age nine, and by age eleven had worked his was up to a Ricoh SLR. In 2004, Paul made the switch to digital and now shoots with Canon DSLRs. In addition to photography, he is an active hiker and whitewater kayaker, and enjoys being in the mountains with his wife, daughter, son, and Golden Retriever. His single favorite location would probably be the shoreline at the upper end of Medicine Lake in Jasper National Park. There he has photographed many cold sunrises, watched and listened to packs of wolves, witnessed a young wolf chase a caribou across the dry lake bed, and observed American dippers and various shorebirds in the rippling waters. By trade, Paul is a professional engineer, and he works as a Senior Research Engineer at an applied research company in Edmonton. Visit his website at:

Post a Comment

Logged in as Anonymous