Years ago, on this very blog, I wrote an article about depth-of-field - what it is, and what things affect it.
Yeah, well, I'm going to do that again.
Why? A couple reasons.
Firstly, I think it's an important photography concept to understand, and one that I still have to stop and think about when composing a shot. And secondly, it lends itself to being summarized in an infographic, which I love creating.
Anyway, back to the subject at hand. Depth of field is simply the distance between the nearest object in focus and the farthest object in focus in a photograph. Of course, the expression "in focus" is somewhat subjective, depending on your eye, the resolution of the image, etc.
Several things affect the depth of field in a photo: the aperture setting of the lens, the focal length of the lens, and the camera's distance from the photo's subject. All three of these things may vary for each photo, so the final depth of field is the result of all of these combined.
This is summarized in the following graphic:
Most photographers intuitively understand aperture's relationship with depth of field without really having to think about it. A wide open lens (for example, f/2.8) typically results in a photo with nice creamy "bokeh" (soft, out-of-focus background). A stopped-down lens (for example, f/22) will bring more of the background, and foreground, into focus.
A long focal length - for example, from a telephoto lens - will create the appearance of a shallow depth of field. Landscape photographers, who typically desire a deep depth of field, often shoot with wide angle lenses. (Note: That isn't always the case, however. But I won't get in to that here.)
Distance to Subject
Anyone who has done any close-up/macro photography will tell you that you're always dealing with a very shallow depth of field. With that type of photography, the camera is often very close to the subject (sometimes just centimeters away, or less).
Composing a Shot - What to Think About
When composing a shot, if the depth of field is important to you (and it typically should be), you should consider all three of these things.
Having said that, aperture and distance to subject are the primary factors. There are some who even doubt whether focal length plays any part in depth of field at all. This is an on-going debate. If you were to take two photos with the same aperture, with one image taken by a wide angle lens and one with a telephoto, and the images were framed exactly the same way (so that you can compare the same scene in both shots), you would have to walk further from the subject with the telephoto in order to keep the same framing. So, if you're doing that anyway, you're adjusting the distance to subject after all. So you could argue that your depth is primarily a factor of aperture and distance only. And, if that's all you care to think about when composing your shot, you'll get the results you're looking for most of the time.
I hope this quick summary of the topic is helpful. As always, if you have any comments or questions, please enter a comment below, or contact me directly.
P.S. It's been suggested that sensor size also affects depth of field. (Thanks for the comment on this, Kirk.) This is, however, a misconception I think. If two shots are taken of the same subject with the same aperture setting, with the same field of view for both images (that part is important), you would need to change your distance to subject and/or your focal length in order to maintain that same field of view with the larger sensor. It's those changes (distance and/or focal length) that affect the depth of field, not the sensor itself.
There's a good explanation of this (and related topics) here: https://www.cambridgeincolour.com/tutorials/digital-camera-sensor-size.htm
Having said that, I've read opinions that differ on this subject. So this is definitely one of those photography topics that's fun to debate!