The short answer
Focal length affects depth of field, but the effect depends on what you keep the same. At a fixed distance to the subject, a longer focal length gives shallower depth of field. If you keep the subject the same size in the frame by moving farther back, the difference mostly disappears at the same aperture.
Focal length at a fixed distance
Imagine standing at the same spot and focusing on a person 10 meters away. A 135mm lens at f/4 will give a noticeably thinner zone of sharpness than a 35mm lens at f/4 on the same spot. The longer lens magnifies the subject more, and the zone of sharpness narrows as a result.
This is the case most people picture when they hear that a telephoto gives shallow depth of field. It is true for that fixed position.
Focal length at a fixed framing
Now imagine you want the person to fill the same part of the frame in both shots. With a 35mm lens you stand close. With a 135mm lens you stand much farther away, to keep the person the same size.
In this case, the two shots have similar depth of field at the same aperture. The longer lens has a narrower view, but you are also farther from the subject. The two effects cancel out, so the zone of sharpness looks roughly the same across the two photos.
The background usually looks different, though. Because the telephoto view is narrower and the background is compressed, the background can look larger and closer to the subject. Depth of field and background appearance are related, but not the same thing.
Why photos from different lenses look different
The result you see depends on how you use the lens. A few common patterns:
- Wide lens, subject at a moderate distance: a fairly deep zone of sharpness that takes in a lot of the scene. Good for landscapes and environmental portraits.
- Wide lens, subject very close: the zone can be shallow after all, because close distance matters more than focal length at that range.
- Telephoto lens, distant subject: a zone that can look shallow because the subject is magnified and the background is far away. Good for wildlife and sports.
- Normal lens, moderate distance: a middle ground that suits everyday photos.
These patterns come from distance and framing working together, not from focal length alone.
Choosing a focal length for depth of field
If you want a thin zone of sharpness at a fixed spot, choose a longer lens and a wider aperture. If you want more of the scene in focus, choose a wider lens, or stand farther away with a longer lens and stop down.
If you want the same framing but a different look, change both the lens and the distance. A longer lens from farther away often gives a more flattering portrait look without much change in sharpness range, while a shorter lens from close up will make the background look more distant and the foreground larger.
Sensor size and the same framing
Sensor size also matters. For the same framing and aperture, a larger sensor produces a shallower zone of sharpness. This is because a larger sensor needs a longer lens (and so a longer distance) to frame the same view, and that combination has its own effect on depth.
Smaller sensors, such as those in many phones and compact cameras, usually give deeper depth of field at the same framing and aperture. This is why those cameras often need software to produce a blurred background.
Practical examples
Here are three ways to use the idea:
- Separating a person from a busy street. Use a longer lens, stand farther away, and open the aperture. The subject stays sharp, and the street softens.
- Photographing a building with a near doorway. Use a wider lens, stand close to the doorway, and stop down. Both the doorway and the building can be sharp.
- Shooting a wide landscape. Use a wide lens and a narrower aperture. The distance is usually great enough that the zone covers most of the scene.
In each case, check the result at full size on screen. Depth of field is easier to judge by looking than by calculating.