General: Calculating Hyperfocal Distance and Depth of Field

Introduction | Considerations Before You Do Any Calculations | Calculating the Hyperfocal Distance | Calculating the Depth of Field | Why Do I Get/Find Different Values from the Ones Published on this Site? | Conclusions | Alternative: Merklinger's Approach | References

On this page, I present how the hyperfocal distance (HFD) and depth of field (DOF) can be calculated based on formulae that I found on the DOFMaster Website. I am using Microsoft Excel for performing the actual calculations.

On other pages, I present the results my calculations of the hyperfocal distance for the Sony RX100 M1, the Ricoh GR and the Leica X Vario as well as for depth of field for the Ricoh GR and the Leica X Vario in various tabular formats.

See the notes on page A Small Glossary of Photography Terms regarding the validity of depth of field and hyperfocal distance calculations as well as of the circle of confusion, on which these calculations are based.



The DOFMaster Website not only offers a depth of field (DOF) calculator but also lists formulae for calculating depth of field tables on your own. Below, I list the formulae for DOF and hyperfocal distances that I use for my own calculations that are presented as tables in various places on this site.

Such calculations are, however, tedious, and error prone process. Therefore, please take the tables presented on this site and elsewhere with a grain of salt. Moreover, particularly for zoom lenses, such tables are not too useful and practical...


The Circle of Confusion (CoC)

... might as well been regarded as a source of confusion...

The original definition of the circle of confusion was based o the resolving power of the human eye, which was assumed to be no smaller than one quarter of a millimeter in diameter on a piece of 8 x 10 paper 250 millimeters from the eye. Merklinger writes:

As a result, most lenses show a DOF scale, provided they have one, that is based on a CoC of 1/30 mm (0.03 to 0.035 mm). Since this is based on a full-format film format, the CoC size has been adapted to different sensor sizes (based on the magnification factor that is much higher than 8, or on the sensor size).

Note: I hit on a discusion in the l-camera-forum debating that the DOF is different for digital and for analog (film) cameras, but for digital cameras still the same calculation is used as for film cameras: It is uses a circle of confusion (coc) that is based on the sensor size (or film size for analog cameras). The argument put forth in an article, entitled Profondeur de champ et capteurs numériques (English version: Depth of field and digital sensors), that was cited there is that not sensor size but photosite size should be the criterion for calculting the coc. According to this article, the coc is simply the photosite size multiplied by a factor of 1.5 (this factor 1.5 can be adapted to specific needs). All in all, this leads to a much smaller coc and consequently also to a considerably smaller DOF.

For the APS-C format (23.6 x 15.8 mm) and an image size of 4928 × 3264 pixels, we calculate the coc as follows:

  • 23.6/4928 = 0.0048 mm => 0.0072 mm (15.8/3264 => 0.0073 mm)

Thus, for the DOF tables that I calculated, I should have used a coc of 0.0072 mm instead of 0.019 or 0.02 mm.

In the above-mentioned thread, FlashGordonPhotography wrote:

  • "... DOF is directly related to the circle of confusion. On digital you need nine pixels to create a circle. There are some visual differences because of this."

Nine pixels for representing a circle means three pixels in one dimension. Thus, we would have to use the size of three photosites x 1.5 to calculate the circle of confusion. This way, we would arrive at a coc of about 0.022 mm, that is, at about the middle between Leica's 0.02 mm and the usual 0.025 mm for APS-C sensors. Or should we use just the factor 3 instead of 1.5? I do not know at the moment...

In short, using the second argument, we would arrive at where we already were at the beginning, and I'll therefore leave everything as it is for the moment... So, before I create new tables, I will first wait how this issue is further discussed in the above-mentioned thread...


Considerations Before You Do Any Calculations

Before you do any calculations, you have to consider which focal length and aperture values are to be used in the calculations.

Focal Length

Please note that for focal length, you have to use the exact focal length, not the equivalent length. For example, use 18 mm instead of 28 mm, which is the "equivalent" focal length for 18 mm for an APS-C camera.

Exact Aperture Values

Aperture values are a bit more tricky. When I compared my initial results wit those of DOFMaster, there were differences for some focal lengths. I found out that there were differences, when the nominal f-numbers were rounded and did not correspond to the "exact" values, which are powers of roots of 2. DOFMaster points out: f-number is calculated by the definition N = 2i/2, where i = 1, 2, 3, ... for f/1.4, f/2, f/2.8, ... - which is true for full f-numbers only... For one-half or one-third aperture steps, it gets even more complicated:

Here is a table of rounded "exact" apertures in full, one-half, and one-third steps:

Step Full One-Half One-Third
0 1.00 1.00 1.00
1 1.41 1.19 1.12
2 2.00 1.41 1.26
3 2.83 1.68 1.41
4 4.00 2.00 1.59
5 5.66 2.38 1.78
6 8.00 2.83 2.00
7 11.31 3.36 2.24
8 16.00 4.00 2.52
9 22.63 4.76 2.83
10 32.00 5.66 3.17
11 -- 6.73 3.56
12 -- 8.00 4.00
13 -- 9.51 4.49
14 -- 11.31 5.04
15 -- 13.45 5.66
16 -- 16.00 6.35
17 -- 19.03 7.13
18 -- 22.63 8.00
19 -- 26.91 8.98
20 -- 32.00 10.08
21 -- -- 11.31
22 -- -- 12.70
23 -- -- 14.25
24 -- -- 16.00
25 -- -- 17.96
26 -- -- 20.16
27 -- -- 22.63
28 -- -- 25.40
29 -- -- 28.51
30 -- -- 32.00

Table: Exact aperture values in full, one-half, and one-third steps rounded to two decimals

You get correct values for the hyperfocal distance (HFD) and depth of field (DOF) only if you use the exact f-numbers. In my tables (see elsewhere), I list both the rounded exact and the "nominal" f-numbers for your convenience.

Note: I noticed that some hyperfocal distance and depth of field calculators use "standard" aperture values. A a consequence, these deliver values that differ from my calculations, which are based on "exact" aperture values.


Calculating the Hyperfocal Distance

According to the DOFMaster Website and Wikipedia (definition 1 of the hyperfocal distance), hyperfocal distance H is calculated using to the following formula:

where f = focal length [mm], N = f-number, c = circle of confusion [mm]; H will also be in mm and has to be divided by 1,000 to deliver results in meters.

This formula can be approximated to:

The approximation corresponds to definition 2 of the hyperfocal distance on Wikipedia (it is also mentioned on the DOFMaster Website).

See also my glossary of terms for the two different definitions of the hyperfocal distance. In the following, I use the first formula (or definition 1) for calculating the depth of field.


Calculating the Depth of Field

The DOFMaster Website bases its formulae for the depth of field (DOF) limits on the hyperfocal distance H and calculates the near and the far DOF limits (near limit Dn, far limit Df) using the following formulae:

where H = f*f/(N*c) + f = hyperfocal distance, according to definition 1 in Wikipedia; f = focal length [mm], N = f-number, c = circle of confusion [mm], s = distance set at the lens [mm]; Dn/f values will be in mm and have to be divided by 1,000 to be in meters.

You can calculate the hyperfocal distance according to one of the two formulae above and then enter the value into the DOF formulae above. The DOF formulae based on the hyperfocal distance H are also useful for calculating the near and far limits (= the DOF) for the extreme case that distance is set to infinity. This is helpful when adopting Merklinger's approach to estimating depth-of-field in landscape photography. See below for the derivation of the results.

As with the hyperfocal distance, the circle of confusion plays (CoC) an important role in the DOF calculations. However, I transformed the formulae so that both, the formula for the near limit and the one for the far limit look, very much the same*. This similarity helped me when using Excel for calculating the DOF tables, particularly when searching for errors.

However, I prefer to arrive at formulae, in which the near and far limits depend only focal length, f-number, circle of confusion, and distance. Therefore, the hyperfocal distance needs to be substituted by its definition.

Substituting the hyperfocal distance H in the near/far limit formulae with its definition leads to:

After some transformations, I arrive as the following formulae for the near limit Dn and the far limit Df:

In these formulae, the near and far limits Df/n depend only on three parameters (just like the hyperfocal distance...) plus the distance s set at the lens:

By the way, using the approximation for H (or definition 2), actually leads to more complex formulae and minor (or major) differences when the different calculations are compared.

Note: Like for the hyperfocal distance, exact f-numbers and real focal lengths have to be used in the calculations.

Approximation (Wikipedia)

Wikipedia uses approximations of the formulae for DOF and hyperfocal distance to calculate Dn and Df:

For H, it uses the approximation:

Substituting H leads to the following approximate formulae:

The above or these formulae lead to minor (or major) differences when the different calculations are compared.

Special Case: Lens Focused at Infinity

The DOFMaster formulae for the near and the far depth of field limits Dn and Df are useful for inspecting a special case, namely, distance set to infinity:

where f = focal length [mm], H = hyperfocal distance [mm], s = distance set at the lens [mm]; Dn/f values will be in mm and have to be divided by 1,000 to be in meters. Now we let s go towards infinity:

The approximations lead to just Dn = H, Df = -H. A negative HFD means a distance beyond infinity, that is, sharpness is at infinity.

Thus, as Merklinger does (and Boone as well), we can state that, when we focus any lens at infinity, the near limit (based on the CoC criterion!) is the hyperfocal distance and the far limit is infinity.

If you do not believe my calculations, you can simply look at the photos below:


Set the distance to infinity and read the near distance or hyperfocal distance from the "near" mark - here f/16


Move the infinity mark to the "far" marker for the chosen f-number - here f/16 - to set the hyperfocal distance


Set the distance to infinity and read the near distance or hyperfocal distance from the "near" mark - here f/8


Move the infinity mark to the "far" marker for the chosen f-number - here f/8 - to set the hyperfocal distance

Photos: When distance is set to infinity, the "near limit" is just the hyperfocal distance, as the photos in the right column prove...


Why Do I Get/Find Different Values from the Ones Published on this Site?

You may have found a Website that offers a DOF/hyper focal distance calculator, or you bought an app that performs these and other calculations. Then you stumble across this Website to find out that the DOF and hyper focal distance values published here differ from the ones that you calculate or read. This is, of course, confusing, and you may rightfully ask who is wrong. In the following, I would like to propose a few answers to this puzzle:

All these differences are minor, but they exist and they can puzzle you. They can also add up…

In my opinion, every application or Website that wants to be trusted should disclose the formulae according to which it calculates its values. This allows its users/visitors to check the validity of the results and to understand why there are differences. Actually, after fiddling around a lot with hyperfocal distance and DOF data, I feel a bit as in the saying "trust only those statistical data that you faked yourself" (or so…). After looking at so many DOF/hyperfocal distance apps/sites, I tend to trust only my own calculations — and those that they are based on, that is, the DOFMaster Website formulae and calculations/calculator.


ExifTool lists "Composite" tags at the end of the Exif data that it supplies (the same does the long-time Mac imaging tool GraphicConverter), among others, the hyperfocal distance (HFD). I therefore assumed that such a thing as a "composite Exif tag" does exist and that some cameras write the hyperfocal distance into the Exif data. I was, however, wrong, as I found out on the ExifTool Website. Author Phil Harvey writes:

For calculating the hyperfocal distance, Harvey uses the FocalLength, Aperture, and CircleOfConfusion tags in the Exif data. This may explain, why I detected differences between the value in the composite HFD tag and my own calculations based on the DOFMaster formulae. I assume, that Harvey does not use the exact aperture value, which is based on powers of two, but directly the one given in the Exif data. Since the deviations can be in either direction, the calculated values may be sometimes too short and sometimes too wide (they should not be taken too strictly anyway...). I checked my assumption but did not arrive at a conclusion yet...



The formulae for the near and far distance that I have derived may look even more complex to you than the original ones, but they offer the advantage that they differ only in one sign, which is very helpful when using Excel. The formulae based on the approximations presented in Wikipedia do not look much simpler either, after the hyperfocal distance was substituted by its definition...

Note that you can also calculate the hyperfocal distance first (either according to definition 1 or 2) and then enter this value into the DOF formulae (the ones given here from DOFMaster or the approximations listed in Wikipedia). I prepared a HFD/DOF calculator ins Excel using all these approaches in order to compare the approximations with the formulae that I use. Overall, the differences are minor...


Alternative: Merklinger's Approach

In his article Hyperfocal distances and Merklinger's method in landscape photography, Kevin Boone discusses hyperfocal distance versus Harold M. Merklinger's approach to estimating depth-of-field in landscape photography. He also discusses simpler approaches, such as using f/8 and setting distance to infinity.

I prepared a page, entitled Merklinger's Approach to Estimating Depth of Field, that covers Merklinger's approach in more detail. In addition, I calculated tables for using a special and simple case of the method for most of my cameras. You will find these pages in the respective sections.



Hyperfocal Distance, DOF




An den Anfang   Homepage  

gerd (at) waloszek (dot) de

About me
made by walodesign on a mac!