Depth of field — how much of a scene, from near to far, appears acceptably sharp — is one of the more misunderstood parts of exposure, partly because it's controlled by three settings at once, not just the aperture most people point to first.
What Depth of Field Actually Is
At any given focus distance, only one exact plane is in perfect focus. Depth of field is the zone in front of and behind that plane that still looks sharp enough to the eye, even though it's not mathematically perfect focus. A shallow depth of field means that zone is thin — a blurred background behind a sharp subject. A deep depth of field means that zone is thick — a scene where everything from a few feet away to the horizon looks sharp.
The Three Controls
Aperture is the one most photographers reach for first. A wide aperture (f/1.8, f/2.8) produces a shallow depth of field; a narrow aperture (f/11, f/16) produces a deep one. This is why portrait photographers shoot wide open to blur backgrounds, and landscape photographers stop down to keep a whole scene sharp.
Focal length has a real effect independent of aperture: a longer focal length (a telephoto lens) compresses depth of field, making backgrounds blur more easily at a given aperture and distance than a wide-angle lens would. This is part of why a portrait shot at 85mm f/2.8 has noticeably more background blur than the same subject shot at 24mm f/2.8 from a distance that keeps them the same size in frame.
Subject distance matters just as much as the other two: the closer you focus to your subject, the shallower the depth of field becomes at any given aperture and focal length. This is why macro photography — focusing just centimeters from a subject — produces extremely shallow depth of field even at narrow apertures like f/11, and why the same lens and aperture that blur a close-up subject's background will keep a distant subject's background mostly in focus.
How the Three Interact
These three don't operate independently — they combine. A wide aperture on a telephoto lens focused close to the subject stacks all three factors toward shallow depth of field, which is exactly the combination portrait and wildlife photographers use for maximum background separation. A narrow aperture on a wide-angle lens focused on a distant subject stacks all three toward deep depth of field, the standard landscape combination.
If you only change aperture but keep composition (and therefore relative distance and effective focal length) the same, you'll see depth of field change, but it's rarely the only variable actually in play — this is why two photographers with different lenses, standing at different distances, can get very different background blur at the same f-number.
Hyperfocal Distance: Maximizing Sharpness Front-to-Back
For landscape work where you want everything from a few feet away to infinity in focus, there's a specific focus distance — the hyperfocal distance — that maximizes the zone of acceptable sharpness for a given aperture and focal length. Focusing exactly at the hyperfocal distance (rather than at infinity, which wastes some of the available depth of field on empty sky) keeps both foreground and background as sharp as that aperture allows. Hyperfocal distance calculators and charts exist for this purpose, or many landscape photographers estimate by focusing about a third of the way into the scene.
When Shallow Isn't Enough: Focus Stacking
Sometimes even a narrow aperture (f/16, f/22) can't capture enough depth of field — extreme close-ups, or a landscape with a very close foreground element and a distant background. In those cases, focus stacking — taking multiple shots focused at different distances through the scene and blending the sharp regions of each in post-processing — produces more depth of field than any single aperture setting can, without the softness that very narrow apertures introduce through diffraction.