First off let me explain what depth of field is Depth of field determines how much of your photo is and isn’t in acceptable focus (note the acceptable this is important). Depending on certain factors depth of field can be few millimetres to infinity and it works both ways from your focus point although towards the camera is only half the distance going away.
There are four things that affect depth of field and once you understand how they all work you can create some amazing effects.
First up we have the lens aperture, the smaller the f/number the shallower the depth of field will be so f/2 will have a much smaller DOF than f/8. Because the aperture is open wider you will have a faster shutter speed, this means light from the background doesn’t fully hit the sensor creating the blurred effect. Although it is worth mentioning when you focus in the distance and objects close to you are blurred this is because the focus plane just hasn’t reached the object so in this case, it is just of out focus.
Next up we have distance from your subject. The closer you get to something the smaller the depth of field becomes. So for example, if you are taking a picture of a flower close-up at f/8 your flower will be in focus but your background will be blurred. When you are doing macro photography the focal distance can be millimetres, this means the nice fully in focus images of a fly, for example, will without a doubt be made up of several images stacked together. As the distance is a factor you can still get shallow depth of field by getting close up even at f/8 just be aware of distortion.
The third thing that affects depth of field is your focal point. For a landscape shot, you don’t want to focus on something in the for ground if you want the whole scene to be in focus. You also don’t want to focus on something in the far distance either, remember coming towards the camera DOF is only half the distance going away. For landscapes you should focus around 1/3 into the scene at f/8 – f/16 this should give you acceptable focus through the whole scene.
Finally, the focal length of the lens you are using affects how much of your photo will be in focus. With cameras like my Fujifilm X100s it’s fixed so there isn’t much I can do about it but on DSLR and mirrorless cameras being able to change the lens will let you affect your depth of field. So a 10mm will have a huge DOF meaning most of your scene will be in focus regardless of your aperture, focal point and distance. Whereas a 200mm depth of field will be much more shallow so being more accurate with your focus is more important.
Using all four of these things you can create some amazing depth of field effects either keeping things in focus or blurring out the background to create separation. Keep in mind “acceptable focus”, this means that things may still be in focus but not razor sharp but as the term implies this is perfectly acceptable.
Photographers tend to get too hung up about razor-sharp photos and while they are nice it’s unlikely that acceptable focus will ruin a shot even if you plan to print it out large. Obviously, it should go without saying but I am going to anyway if you miss your depth of field altogether it will result in an out of focus shot that no amount of sharpening will fix so make sure your DOF is long enough for the effect you are going for.