Depth of field is how much of the scene, from front to back, looks sharp. A shallow depth of field isolates a subject against a soft background; a deep one keeps everything from foreground to horizon in focus.
Four things control it
- Aperture: wider (smaller f-number) means shallower depth of field.
- Distance to the subject: the closer you are, the shallower it gets.
- Focal length: at the same framing, longer lenses make backgrounds look blurrier because they magnify them.
- Distance from subject to background: move your subject away from the wall behind them.
For portraits
An 85mm f/1.8 on full frame (or a 56mm f/1.4 on APS-C) is the classic recipe. Don't always shoot wide open: at f/1.4 on a close face, the eyes can be sharp while the nose is soft. f/2-f/2.8 is often safer.
For landscapes
f/8-f/11 keeps most scenes sharp. Going much beyond f/16 softens the whole image through diffraction, so use focus stacking if you need more.
Sensor size
At the same framing and aperture, bigger sensors give shallower depth of field. f/1.8 on Micro Four Thirds looks roughly like f/3.6 on full frame. That's a reason to choose full frame for portraits, and a reason Micro Four Thirds suits video, where more depth of field is often useful.