How Does Autofocus Work on a Camera? | The Two Systems Explained

Autofocus works by measuring focus error and moving the lens until the subject is sharp, using either phase-detection or contrast-detection methods.

Every modern camera solves the same problem: how to tell whether a subject is in focus, and how far the lens needs to move to make it so. The answer determines how fast your camera locks on, whether it hunts in low light, and why some shots come out sharp while others don’t. Understanding the two main autofocus systems explains all of it.

Phase-Detection AF: The Speed System

Phase-detection autofocus splits incoming light into two images and compares their alignment, much like two eyes working together. The camera measures how far apart those images are and instantly knows both how much and which direction the lens must move to achieve focus.

This is why phase-detection feels immediate. Instead of guessing and checking, the camera calculates the exact correction needed and instructs the lens motor to move directly to the sharp position. DSLRs use this system through the optical viewfinder with a dedicated AF sensor, which is why they’ve long been the choice for action and sports photography.

The trade-off is complexity. A dedicated phase-detection sensor requires a mirror mechanism to divert light, which is why this approach lives mostly in DSLRs. In more recent mirrorless designs, the same math happens on the imaging sensor itself.

Contrast-Detection AF: The Precision System

Contrast-detection autofocus works like a photographer squinting at a screen: it evaluates the contrast in the sensor area and considers focus correct at the point of maximum sharpness. The camera moves the lens, checks whether contrast improved, and repeats until sharpness peaks.

The honest weakness here is speed. Because the camera doesn’t know which direction to turn the lens initially, it can “hunt” — trying adjustments back and forth until it finds the contrast peak. Low light, low contrast scenes, or fast-moving subjects make this hunting more likely and more noticeable.

Where contrast detection shines is precision. It uses the actual image you’re capturing, so what you see is what you get — the same reason mirrorless cameras and DSLR live view modes use this approach on the imaging sensor.

Modern cameras often combine both systems. Canon’s Dual Pixel CMOS AF, for example, uses every pixel for both imaging and phase-detection, with two independent photodiodes per pixel determining focus deviation and direction. That hybrid approach delivers the speed of phase detection with the accuracy of contrast detection.

AF Modes: Locked or Tracking

Once the camera knows how to focus, the AF mode decides whether it keeps focusing. The two main modes answer different questions: do you want focus locked, or do you want the camera to follow a moving subject?

AF-S (single-servo) locks focus once acquired and holds it. Sony’s documentation describes this as focus locking when the shutter button is pressed halfway — ideal for static subjects like landscapes or portraits. AF-C (continuous-servo) keeps adjusting focus while the shutter button is held halfway down, making it the right choice for moving subjects.

Some cameras add a third option. Nikon’s D7500, for instance, offers AF-A, which automatically switches between the two. In continuous modes, Nikon’s predictive focus tracking can anticipate where a moving subject will be, adjusting focus during the half-press so the shot is sharp the moment you fully press the shutter.

AF System How It Works Best For
Phase-Detection Splits light into two images, measures alignment, moves lens directly to focus Fast action, sports, DSLR viewfinder shooting
Contrast-Detection Moves lens, checks contrast, repeats until sharpness peaks Static subjects, precise focus, mirrorless and live view
Hybrid / Dual Pixel Combines both methods on the imaging sensor Speed plus accuracy in one system

What Autofocus Means For Your Photos

Autofocus performance depends on the camera’s architecture, the AF mode you select, and whether you’re shooting through the viewfinder or in live view. A DSLR’s dedicated phase-detect sensor through the viewfinder behaves differently from the same camera’s sensor-based autofocus in live view.

If you’re choosing a camera and autofocus performance is your priority, it helps to see the options side by side. Our tested roundup of the best cameras with autofocus compares real-world performance across the systems described here.

Canon’s professional network explanation of autofocus goes deeper into Dual Pixel technology, while Nikon’s D7500 manual details how predictive tracking behaves in practice. HowStuffWorks also offers a solid technical breakdown of the physics behind both systems.

FAQs

Why does my camera hunt for focus in low light?

Contrast-detection autofocus relies on visible detail to measure sharpness, so dim or low-contrast scenes give it less information to work with. The camera then tries multiple lens positions to find the contrast peak, which appears as hunting. Phase-detection systems generally handle low light better because they measure light alignment rather than contrast.

Is phase-detection always faster than contrast-detection?

Usually, yes. Phase-detection knows the direction and distance the lens must move, so it goes straight to focus. Contrast detection must test and compare positions, which takes more time. Hybrid systems like Canon’s Dual Pixel combine both benefits, giving phase-detection speed with the accuracy of reading the actual image.

Why won’t my autofocus track a moving subject?

Check your AF mode. If the camera is set to AF-S, it locks focus once and holds it — a moving subject will drift out of the locked focus plane. Switch to AF-C or continuous-servo mode so the camera keeps adjusting focus while you hold the shutter button halfway down.

References & Sources

Please use a real email you check. If it's fake or mistyped, your message won't reach us and we can't reply — wrong addresses are rejected automatically.