What depth of field is
A lens focuses perfectly at only one distance. In front of and behind that distance, points turn into tiny blurred discs. While those discs stay smaller than the circle of confusion, our eyes still read them as sharp. The zone where this is true is the depth of field (DOF).
The formulas this calculator uses
All lengths are in millimetres. f is the focal length, N is the f-number, c is the circle of confusion and s is the focus distance.
c = sensor diagonal / 1500 H = f² / (N·c) + f (hyperfocal distance) near = s(H − f) / (H + s − 2f) far = s(H − f) / (H − s) (∞ when s ≥ H)
These are thin-lens formulas. They are very accurate at normal distances and less so in macro work. The circle of confusion assumes a typical print or screen viewed at a normal distance. If you look at pixels at 100%, everything gets "less sharp".
Hyperfocal distance in practice
Focus at the hyperfocal distance H and everything from H/2 to infinity is acceptably sharp. That makes it ideal for landscapes and night skies. Stopping down helps, but only up to a point. Past about f/11 on APS-C (f/16 on full frame), diffraction starts to soften the whole image.