Depth of field
Sensor, focal length, aperture and subject distance: find the sharp zone (from where to where) and the hyperfocal distance for landscapes.
How it works
Depth of field is the zone that looks sharp around the focus point: it depends on focal length, aperture, distance and sensor size (via the «circle of confusion»). Small apertures (high f-numbers), short focals and distant subjects increase it; telephotos and wide apertures shrink it (the «blurry background» effect).
The hyperfocal trick
Focusing at the hyperfocal distance makes everything from half that distance to infinity sharp: the classic landscape technique. Standard optical formulas; values are indicative because «acceptable sharpness» also depends on print magnification.
The four things that decide it
The aperture is the most direct control: closing it from f/2 to f/8 widens the sharp zone enormously. The distance from the subject counts even more, and not linearly: coming in to half a metre collapses depth of field to a few centimetres, which is why macro work is so hard. The focal length works the same way: a telephoto isolates, a wide angle keeps everything sharp.
The fourth is the sensor, and it acts indirectly: to frame the same scene with a small sensor you have to use a shorter focal length or step back, and it is those two things that change the result. It is why a phone struggles to blur a background and a full-frame camera does it effortlessly.
The circle of confusion, that is what «sharp» means
Away from the plane of focus, a point is no longer a point: it becomes a small disc. As long as that disc is small enough the eye reads it as sharp, and the threshold below which that happens is called the circle of confusion. It is not a universal constant: it depends on how much the photo will be enlarged and from how far it will be looked at.
From which follows something disconcerting: depth of field is not a property of the photo, but of the photo and the viewer together. The same image seen as a thumbnail on a phone is sharp all over; printed and viewed from a metre it reveals that focus was slightly behind. That is why the calculated values are indicative and should be taken as an order of magnitude.
The hyperfocal, and its price
Focusing at the hyperfocal distance gives the widest possible sharp zone: from half that distance to infinity. It is the classic landscape technique, and it mattered when cameras had a distance scale engraved on the lens.
It has a cost the manuals rarely mention, though: at infinity sharpness is only at the edge of acceptable, not at its best. If the photo contains a distant mountain that has to be crisp, it is better to focus there and accept a soft foreground, or take two shots. The landscape photographer's rule of thumb is to focus about a third into the scene and stop down, then check by magnifying on screen.
Stopping down too far makes it worse
Beyond a certain point, closing the aperture stops adding sharpness and starts removing it: light passing through a very small hole diffracts, and the image softens across the whole frame. The threshold depends on the sensor, and comes earlier on small ones: on APS-C it shows around f/11, on full frame later.
The practical consequence is that f/22 is almost never the right choice for getting everything sharp: more is lost to diffraction than gained in depth. When everything really has to be sharp, the modern route is focus stacking, that is several shots at different focus points merged afterwards.
Nearby tools
For the other photographic calculations there is ND filter calculator. On the resulting images work Resize photo, Compress image and Convert image, and the shooting data is read in Photo EXIF data.