Conventional wisdom has it that you should keep the background in your photos out of focus to draw attention to the subject in the foreground. Generally that's good advice, but sometimes you might want everything to be in sharp focus, from the foreground elements all the way to the distant background. If you have a camera that lets you adjust the focus manually (think DSLRs and advanced compacts), you can accomplish this effect using a technique called hyperfocal photography.
Despite the intimidatingly technical name, hyperfocal photography isn't especially complicated. The term simply refers to taking a picture in a way that delivers the maximum possible depth of field.
Sounds easy--after all, you already know that large f-numbers yield deeper depth of field. So picking the biggest f-number available (say, f/22) would automatically give you a hyperfocal photo that's uniformly in focus, right?
Not so fast. There's a little more to the story of hyperfocal photography. It also requires you to shoot at something called the hyperfocal distance.
Imagine that you want to take a photo of a person standing 10 feet in front of you, and that you want the entire shot--including the distant mountain range in the background--to be in focus. If you set the camera to aperture priority mode and dial in f/22, and then focus on the subject in the foreground, you might end up with a total depth of field that's about 15 feet, extending a little in front of the person and a little behind. The mountains off in the distance will be a blur. So simply setting your camera to the deepest possible depth of field won't work.
Now use the same settings, but focus on the faraway mountain range. The depth of field might now start about 18 feet in front of the camera and go all the way to infinity. That's awesome: The mountains are in sharp focus, along with anything and everything in the frame beyond 18 feet. But the subject? At just 10 feet away, the person is a blur.
What's going wrong? In both cases we're "wasting" perfectly good depth of field. When we focused on the subject, the depth of field in front of the person went unused. And when we focused on the mountains, any depth of field behind the mountains was wasted, because it's already at infinity.
The solution: We need to focus on an intermediate location so that the furthest extent of the depth of field just reaches infinity, and so that the depth of field shifts forward to put as much of the scene in sharp focus as possible. That location is the hyperfocal distance. In our imaginary portrait, the hyperfocal distance is about 18 feet. If you set the camera's focus on 18 feet, the near limit of the depth of field is 9 feet. And the far limit is (and always will be for a hyperfocal shot) infinity. Take that shot, and the 10-foot-away subject and everything to infinity will look sharp.
Where did all those numbers come from? How did I know what the hyperfocal distance would be? In the age of film photography, camera lenses had hyperfocal marks inscribed on them, but those days are long gone. Now, the easiest way to tell is with a tool that calculates the hyperfocal distance for you.
My favorite is the online depth-of-field calculator DOFMaster. Just enter the kind of camera you own (if you don't see your particular model, you can pick a similar one), and choose the focal length of your lens. On the right side of the page, you'll see the hyperfocal distance listed. Enter that number in the 'Subject distance' field, and calculate--you'll be rewarded with the near and far limits of the depth of field.
If you have an iPhone, the DOFMaster app ($2) is even easier to use. After specifying your camera settings, tap the HD (hyperfocal distance) button to learn what distance to focus on and what the near and far depth-of-field limits are.
Of course, hyperfocal photography is really practical only on cameras that let you both control the aperture and manually set focusing distance, so digital SLRs and advanced compact cameras will have an easier time. Smartphones and very simple point-and-shoot cameras, on the other hand, lack a way to set the focus distance to a specific value, so they are not good candidates. That said, the tiny size of smartphone image sensors means that smartphone photos tend to have a fairly deep depth of field anyway, so with a little experimentation, you can often get hyperfocal-like photos without any special effort.