Schematic depiction of the circle of confusion. Theoretically, when a lens is focused on a certain point, exact sharpness will only be obtained in the plane of focus. However, some degree of unsharpness is not possible to decipher for us, and this will still be observed as sharp, while in reality it's already out of focus. When a point source of light is out of focus it will form a circle on the sensor (indicated for the red light source by the curly bracket in the picture on the right), and the size of the circle where we start observing it as out of focus is called the circle of confusion (CoC). So if a point source is out of focus, but its size on the sensor is still smaller than the circle of confusion, we'll observe it as sharp, but if it is bigger than the circle of confusion, we will regard it as unsharp.
The circle of confusion of a print depends on several factors, like the size of the print, the distance from which it is viewed, and last but not least, who is viewing it as some people have better vision than others. As a rule of thumb, the human eye can decipher approximately 5 line pairs per mm (lp/mm) at a viewing distance of 30 cm. If the size of a print is doubled while the viewing distance is kept the same, then some details which looked sharp before will now look unsharp. Similarly, if you look at a print from a closer distance you see some unsharp details, which looked sharp from a distance.
The circle of confusion for the sensor depends on two things; the circle of confusion which was calculated for the print, and the enlargement of the print. This means that for a smaller sensor the picture will have to be enlarged to a greater extent to obatin a similarly sized print, therefore the circle of confusion for the sensor will decrease. A sharpness obtained with a circle of confusion of 0.03 mm at full frame, will be comparable with a circle of confusion of 0.02 mm when using a camera with a crop factor of 1.5 (0.03/0.02). In general, 0.03 mm is taken as the standard circle of confusion for 35 mm format. However, modern equipment has better quality than the equipment on which the value of 0.03 was based and many use a smaller circle of confusion nowadays. It's up to ones personal preferences.
The hyperfocal distance is the point of focus where everything from half that distance to infinity falls within the depth of field. In other words, everything from half the hyperfocal distance to infinity will be sharp. The hyperfocal distance depends on the focal length and the chosen aperture, so either you don't care, or you take a printed chart with the values for the most common focal lengths and aperture values. I do care, but I am too lazy to check the chart every time, so I've memorized the formula below (the "+ f" can in most cases be neglected since the focal length will usually be far smaller than the hyperfocal distance).
Some rules of thumb for the hyperfocal distance (the most important being the second one):
Hyperfocal distances for a range of apertures and focal lengths can be calculated below (all hyperfocal distances are given in meters).
Depth of field (DOF) is defined as the distance ranges from the camera within which a subject will appear sharp on a print of a certain size viewed from a certain distance. The circle of confusion and the depth of field are directly related since the circle of confusion defines what is sharp and what is not. Other factors influencing the depth of field are the focus distance, focal length and the aperture. For macro photography, the depth of field is a real challenge, as it becomes very shallow at short focus distances. In that case, focus stacking might be an option.
Schematic depiction of how the DOF changes for different apertures => The scheme to the left shows why the aperture size is of such a big influence on the depth of field. The aperture is depicted by the black bars, and focus is on the blue spot for each case (so no matter which aperture is chosen, the blue spot will be rendered sharp), whereas the red spot is out of focus. The inset in the lower left corner is an approximation of how the two spots will be rendered on the sensor.
From this scheme it can be seen that a large aperture will give rise to a much larger size on the sensor for out of focus objects, compared to a small aperture. In fact, if the aperture is small enough, objects will still be observed as sharp (depending on the chosen circle of confusion), even though the focus is not on them. If the size of the red spot on the sensor is smaller than the circle of confusion, it will be observed as sharp, otherwise it will be observed as unsharp.
The picture below on the left has a very shallow depth of field, only the mushroom is sharp, whereas everything behind it is out of focus. The picture on the right has a large depth of field, as both the plants in the foreground and the plants in the distance are sharp.
The picture below on the right shows how the aperture is of major importance for the depth of field. In the first example, the aperture is f/4, and the background is obviously unsharp (focus is on the tree on the right). However, the second example is made at f/22 and this results in a sharp background! Note: when viewed at 100 %, the background in the f/22 picture is no longer really sharp, which is an example of how the enlargement is important for defining what is sharp and what is not sharp. But in this case, the enlargement is small enough to make the background appear sharp.
Example of how the DOF changes for different apertures => This can also be calculated by using the calculators for circle of confusion and depth of field. If we say that the picture will be viewed from approximately 30 cm (which means the picture resolution will be 5 lp/mm), and the picture is about 14.0 × 9.3 cm (which it is on my screen), then the circle of confusion calculator gives us a value of approximately 0.05 mm. If we use this value in the depth of field calculator, together with an aperture of f/4, a focal length of 20 mm and a focus distance of 0.63 m, then we see that the depth of field ranges from 0.48 m to 0.92 m. So, the tree on the right will be sharp, but everything from 0.92 m and beyond will be observed as unsharp, and this corresponds with the first picture. Calculating the same for f/22 gives a depth of field ranging from 0.23 m to infinity, and this corresponds with the second picture, where everything is observed sharp!
Generally speaking, a lens with a longer focal length has a shallower depth of field, although that depends a bit on how pictures for different focal lengths are compared. It is true that a lens with a long focal length enlarges the background much more than shorter focal lengths, and this makes that they more often have blurry backgrounds. But it also depends on the focus distance.
The pictures on the left shows schematically what happens with the picture for different focal lengths and magnifications. The one on the right shows an approximation of what the picture will look like for each case. Focus is on the black tree for every case. • The first picture shows the result for a lens with a long focal length, which is a sharp black tree and a blurry grey tree. • If we switch to a short focal length, but take the picture at the same spot, then the focus distance is identical and the second picture is obtained. Everything in the picture has become a lot smaller and everything is sharp (although this does depend a bit on the chosen aperture. If the aperture is very large, then chances are that the grey tree will also be blurry). • If we maintain the short focal length, but approach the black tree in order to obtain the same magnification, then the third picture is obtained. The black tree is the same size as in the first picture, but the grey tree is a lot smaller due to the larger field of view. The grey tree is blurred to the exact same extent as in the first picture (for an explanation on this, see below under meters & micrometers/infinity blur), but since it is much smaller, we will still observe it as sharp (again, this does depend a bit on the chosen aperture. A large aperture can also in this case give a blurry grey tree).
The near and far distances of acceptable sharpness (which is what determines the total depth of field) can be calculated with the formulas below:
The depth of field can be calculated with the calculator below (distances greater than 9999 m are considered infinite). The tree icon stands for the subject which the camera is focussed on.
Depth of field  depth of field and focal length
Calculated for magnification = 0.026, circle of confusion = 0.03 mm and f/8. It is often said that the depth of field is constant regardless of the focal length as long as the magnification is constant, this is however not entirely true. This is a plot of the depth of field vs focal length at the same magnification, which shows that the depth of field is constant regardless of the focal length (at the same magnification) only from a certain focal length. But the only exceptions are wide angles (a focal length of 20 mm or less starts to give a significant difference), so in practice, it can be used as a rule of thumb. Depth of field  depth of field and focus distance
Calculated for focal length = 50 mm, circle of confusion = 0.03 mm and f/8. Another misconception about the depth of field is that it is distributed as 1/3 in front and 2/3 behind the point of focus. This is a plot of the depth of field vs focus distance (focus distance is the distance between subject and sensor), which shows that depth of field distribution is nowhere near the assumed 1/3 in front and 2/3 behind. The rule of 1/3 in front and 2/3 behind the point of focus is only valid at a focus distance of 1/3 of the hyperfocal distance, all other focus distances have a different ratio.
At larger focus distances more and more of the depth of field will be behind the plane of focus. On the other hand, at very small focus distances (like with macro photography), the depth of field will be distributed equally much in front as behind the plane focus.
In the example on the left, the hyperfocal distance can be calculated to be 10.5 meter, and in the graph we can see that at 3.5 meter (10.5/3) the distribution is indeed 1/3 and 2/3.
Depth of field  depth of field and sensor size
It is often said that cameras with smaller sensors have a larger depth of field, but this depends a bit on how you determine this. Let's consider two 10 mp cameras, a full frame camera A, and camera B with a sensor size which is half the size of full frame, so with a crop factor of 2. If we take a picture with camera A equipped with a 50 mm lens, then we need a 25 mm lens on camera B to have the same field of view. Furthermore, the circle of confusion becomes half the size for camera B, to compensate for the bigger enlargement, which is needed to obtain similar prints of the same size. When the aperture number is kept identical, then indeed the depth of field is larger for camera B:
However, if we keep the aperture size constant, then the depth of field is more or less identical!:
So if the aperture number is kept identical, then indeed the depth of field is larger for a camera with a smaller sensor. But if not the aperture number, but the aperture size is kept constant, then the depth of field is more or less identical for both cameras. This can be done easily by dividing the aperture number for the full frame camera by the crop factor for the second camera. This will give the aperture number which will give the same depth of field on the camera with a smaller sensor. So, in this case, an aperture number of f/8 for camera A, divided by a crop factor of 2, gives an aperture number of f/4 for camera B.
Do keep in mind that for short focus distances, the field of view for a specific focal length is altered significantly (for more on this, see lenses/field of view and lenses/magnification). So, in the case of short focus distances, obtaining a similar field of view means altering the focal length a bit and at that point, the relationship described above is no more than an approximation.
But in the end, it is of course a fact that cameras with small sensors don't have the aperture range to compete with the shallow depth of field's of large sensor cameras at wide apertures. Likewise, the large depth of field obtained with small sensors at small apertures is difficult to obtain with large sensor cameras.
Depth of field  taking diffraction into account
As explained under lenses/magnification, diffraction has a signicant impact on image sharpness, and this isn't taken into account in the calculations for e.g. depth of field. Those calculations are based purely on the effect of defocus, but in real life both defocus and diffraction take place simultaneously. When knowing both the blur caused by defocus and the blur caused by diffraction, the total blur can be approximated by this formula:
But fortunately, rather than adapting the depth of field calculators, there is an alternative and relatively easy way to determine the optimal camera settings, which I read about here, here and here. If you have a foreground subject at distance D_{n} and a background subject at distance D_{f}, then the optimal focus distance can be calculated with the formula below:
In case the distance to the background subject approaches infinity, the optimal focus distance is two times the distance to the foreground subject, which is the hyperfocal distance. So when the subject in the background approaches infinity, finding the optimal focus distance is easy; two times the distance to the foreground subject:
So now that the optimal focus distance is known, we only need to find the optimal aperture. A small aperture gives less defocus at the foreground and the background_{}, but gives more diffraction in stead. On the other hand, a large aperture gives more defocus at the foreground and the background, but less diffraction. Somewhere the combination of these two effects has an optimum, and that optimal aperture can be found by using this formula:
This calculator calculates the optimal conditions according to the previous two formulas, as well as the blur on the sensor for both the point of focus (caused by diffraction) and the foreground/background (caused by both defocus and diffraction).
Infinity blur is the size of a projection on the sensor of a point at infinity at a certain focus distance. It can be calculated by multiplying the aperture size with the magnification.
Some rules of thumb: • The infinity blur will have the same size as the aperture when magnification is 1:1 (which is when the focus distance is four times the focal length). • When focussing on the hyperfocal distance, the infinity blur will be equal to the circle of confusion. • At focus distances greater than the hyperfocal distance, the infinity blur will be smaller than the circle of confusion and objects at infinity will be observed as sharp. • And of course, when focused on infinity, the infinity blur will be close to zero.
However, like described for depth of field further up on this page, the above formula ignores the effect caused by diffraction. Combining the infinity blur with the blurring caused by diffraction can be done with this approximation:
This calculator calculates both the infinity blur, and the combined effect of infinity blur with diffraction.
Infinity blur  infinity blur and focal length
Calculated for magnification = 0.01 and f/8. On the right is a plot of the focal length vs the relative infinity blur, which is probably the lamest graph ever produced as it is just a straight line. The relative infinity blur is the infinity blur as it is observed with the blurred objects at infinity at the same size (as opposed to the "normal" infinity blur, where the object of focus is kept at the same size). This relative infinity blur can be obtained by dividing the infinity blur by the focal length.
This shows that the relative infinity blur is constant, even at small focal lengths. This is in contrast to the depth of field which is not constant at smaller focal lengths.
The fact that the relative infinity blur is only dependent on the aperture can also be deduced from the formulas. As described above, the infinity blur is defined as the aperture sized multiplied by the magnification:
And since the relative infinity blur can be obtained by dividing the absolute infinity blur by the focal length:
As can be seen above, the relative infinity blur can be determined by dividing the magnification with the aperture number, and since we are keeping the magnification constant, the relative infinity blur only depends on the aperture number.
Of course, the effect of diffraction is ignored here. If we do take the effect of diffraction into account, then the formula will look like this:
So when taking diffraction into account, the total relative infinity blur is no longer independent of the focal length, but this will only start to play a roll at small apertures, and especially for short focal lengths. To the right are photos of the same tree, photographed at different focal lengths and different apertures. The tree (which was the point of focus for each photo) was kept at the same size in all photos, in order to keep the magnification constant. Then I took the area with the patch of snow in the distance and enlarged it so it has the same size, regardless of the focal length. If the relative blur is the same, then the blur should be the same as well in these enlargements. Although the 50 mm lens seems to have a bit less blur for all four apertures for some reason, the results correspond pretty well with the theory: • At f/4, the influence of diffraction is negligible, and the total relative infinity blur should be constant regardless of the focal length. And indeed, the blur is reasonably constant in the first row. • At f/7.1, diffraction is still negligible, and the total relative infinity blur is still pretty much identical. • At f/13, diffraction starts to influence the shorter focal lengths, and indeed the 24 mm shows a bit more relative blurring than the other three focal lengths. • At f/22, diffraction is getting strong for short focal lengths, and the 50 mm shows a bit more blurring, whereas the 24 mm shows a lot more blurring.
