How to Calculate Depth of Field

A big stumbling block for many new camera users is how to figure out how much depth of field a particular image will have it in given the focal length of the lens, the aperture used and the distance to the subject. Trust me on this, trying to do the algebra to figure it out is not something most people want to try to do in their heads. In this article we will cover all the math involved and then make it real easy with an Excel spreadsheet and some links to some free applications to help you out.

The Math
Feel free to skip right over this part, this is the boring part, it’s so boring I thought of putting a picture of an artistic nude shot next to it just to keep people awake. Ok, so here we go. Before you can calculate the depth of field you first must know the circle of confusion for your camera.

Wikipedia: In optics, a circle of confusion, (also known as disk of confusion, circle of indistinctness, blur circle, etc.), is an optical spot caused by a cone of light rays from a lens not coming to a perfect focus when imaging a point source.

Don’t get too lost on me yet, for most of us digital SLR users this is  one of two numbers. For most of us with APS/APS-C sized sensors this number is 0.019948, for full frame sensors (the big Pro cameras) and 35mm film the number is 0.02501. This represents the sensor size. Again, don’t get all lost on me yet, just remember the number for your particular camera.

The first thing we need to calculate is the Hyperfocal distance, for this calculation you will need to know the focal length of your lens. the aperture you are using and the CoC (circle of confusion) for your camera.

Wikipedia: the hyperfocal distance is the closest distance at which a lens can be focused while keeping objects at infinity acceptably sharp; that is, the focus distance with the maximum depth of field. When the lens is focused at this distance, all objects at distances from half of the hyperfocal distance out to infinity will be acceptably sharp.

The math to calculate the hyperfocal distance is as follows:

HyperFocal = (FocalLength * FocalLength) / (Aperture * CoC)

Thus, the Hyperfocal distance of a 50mm lens at f/2.8 on an APS sensor (Canon 30D in my case) is 146.85 feet.

Next we need to calculate the near point which is the closest distance that will be in focus given the distance bdetween the camera and the subject. The math here (yes, it gets SO much worse) is as follows:

NearPoint = (HyperFocal * distance) / (HyperFocal + (distance – focal))

This is somewhat  complicated because the focal length is in millimeters and those of us in the US are better with feet and inches still so if you want the end value to be in feet you have to do some more conversions. If we are using the same 50mm lens, at f/2.8 on an APS sensor at a distance of 10 feet (3048mm) then our HyperFocal distance is 146.85 feet (44,749.23mm), giving us a near focus point of 9.37 feet (2,856.66mm). Are we following along still? Did I lose anyone?

Alrighty then, let’s now calculate the far point distance, this is almost the same as before but using slightly different math, so here we go.

FarPoint = (HyperFocal * distance) / (HyperFocal – (distance – focal))

Without changing our values that we used before, we now know that are rear point is 10.72 feet (3,266.81mm). Take note that the near point is actually closer to you than the subject is, typically the focus is 1/3 in front of the subject and 2/3 behind the subject.

The final step is to calculate the total amount of focal distance. This is one I can even do without a calculator, we simply subtract the far point distance from the near point distance.

TotalDof = FarPoint – NearPoint

Giving our example so far we have a total depth of field of 1.35 feet (411.48mm).

Let’s get practical
Why on earth would you want to know this? The simple answer is you may not, nor may you ever care to know it. When shooting portraits, weddings, events, and pretty much anything else it really isn’t going to matter much. However, if you are the type that wants to set up a shot and have it be EXACTLY what you want, there is simply no other way to know what the camera is going to do. This is important in macro, food, and product photography. By knowing exactly where you focus points begin and end you can more accurately design and execute precise shots.

Ok, how about the easy way?
This is kind of like taking a digital photography class and having to spend a semester cooking your own B&W film, its good to know the theory before taking on the practical application. So how can we do this easier than having to pull a scientific calculator each time you want to set up a shot?

  • f/Calc Spreadsheet (download) – This is an Excel spreadsheet that will do all the math for you. This was development by me and is free to use.
  • f/Calc Windows and Palm App (website) If you want a simple but powerful Windows or Palm based application, f/Calc does Field of View, Angle of View, Magnification, Spot Meter, f Numbers, Depth of Field and Hyperfocal distance
  • PhotoCalc for iPhone (website) – Not only does it do everything for DoF, it also incorporates a sunrise/sunset function, flash exposure calculator, and Exposure Reciprocation calculator.
  • CamCalc (Market) Android App for Depth of field, field of view, focal length equivalents, flash calculations, color temp. conversion, miniatures, and sunrise, sunset.
  • PhoforPho (Market) Android App with Exposure calculator, Hyperfocal calculator, DoF calculator, Timer, and Exposure compensation calculation for multiple exposures.

I know this has been a doozy of an article to read through just to get to some free or almost free (PhotoCalc is $2.99) tools to make it dead simple to do these calculation. Hopefully this will help you perfect your images help you to use depth of field to its full extent.


Kerry Garrison lives in Castle Rock, Colorado with his wife and two dogs. With 10 years of experience shooting products and 5 years of experience in the wedding industry, Kerry brings a good deal of technical know-how and can explain topics in easy-to-understand terms.

You may also like...

21 Responses

  1. kgarrison says:

    When I am doing product shots I want to have exact control over my work and will even print out a shot list with all of the camera settings on it before I go out to the studio. This is like going to the grocery store with a shopping list. I make sure I get exactly what I want and end up getting a few extras. Let's say I am shooting a picture of a phone, I want to be absolutely certain that the front and rear of the item is in focus given a specific distance and lens, with these tools I can run the numbers and come up with the exact combo of settings to achieve what I want.

  2. Bryan says:

    This is great info! I always knew that wider apertures made for shorter dof, but now I can actually put some specific numbers behind it.

  3. Photo Larry says:

    Three things determine Depth of Field:
    1) Distance from the subject (Close=Deep, Far=Shallow)
    2) Focal Length (Short=Deep, Long=Shallow)
    3) Aperture (Small=Deep, Open=Shallow)
    These are over simplified but better to explain to a novice.

  4. kgarrison says:

    Good comment Larry. We have discussed depth of field before but this article was on how to calculate it exactly. Learning the basics is very important as well.

  5. Anonymous says:

    If you have problems still, right click on the link and save the item to disk.

  6. Dr Pet's says:

    Tks. very interesting and usefull

  7. Terry says:

    This is great but can you tell me what point on the camera that you measure the distance from? I believe that on film cameras it is from the film plane which is usually marked. What about digital? I'm interested in determining the f-stop necessary for the desired depth of field when doing macro work. Thanks.

  8. adedavies says:

    Wow! Finding this site is like discovering gold! Thanks for your huge help, Ade

  9. adedavies says:

    Wow! Finding this site is like discovering gold! Thanks for your huge help, Ade

  10. adedavies says:

    Finding this site is like discovering GOLD! Thanks, Ade

  11. Anonymous says:

    This website was really useful but for some reason I think the parts where you did the math is of. I've been trying o do the calculations myself but they're coming out differently. But the equations are right so that's really all I needed. Thanks for the info!

  12. HowToDoWiki says:

    Your article really helped me in calculating the depth, thanks mate.

  13. Guest says:

    Is it OK to replace feet by meters and will the results still be adequate after this little change?

  14. balanescu says:

    How to control Depth of field is mainly depended by aperture size though other factors come into play including the focal distance of the lens and the space the background is from the subject.

    just for share same article, check it here:

  15. nehal vyas says:

    An emmetropic eye is viewing a scene and has accommodated so that it is acting as a hyperfocal system. If the eye has a pupil diameter of 3mm find:

    (i)The depth of field.

    (ii)The distance of the point on which the eye is focusing.

    (iii)The range over which objects appear to be clear.

    (iv)The accommodation required.

    Can you tell me how to calculate pls

  16. chris says:

    Great article. Thanks for the app links!

  17. darek says:

    Good and clear article but i know different formula for hyperfocal calculation:
    (focalLength*focalLength / aperture*coc) + focalLength

    btw. yesterday i released my depth of field calculator:

    I'll be more than happy to get feedback.

  1. January 31, 2009

    […] have talked about selective focus here numerous times using depth of field (here) (here) (here) and lenses such as the Lensbaby 3G. Selective focus simply means that the main […]

  2. June 5, 2012

    […] How to Calculate Depth of Field […]

  3. October 29, 2012

    […] How to Calculate Depth of Field […]

Leave a Reply