If you pick the wrong aperture or focal length when precision is non-negotiable—in machine vision, cinema, or lab setups—you'll end up with important details falling out of the focus range. That often means missed shots or failed inspections. This Depth of Field Interactive Calculator helps you work out near and far focus limits, the overall depth of field, and hyperfocal distance using focal length, aperture, subject distance, and sensor width. These figures matter in inspection tasks, filmmaking, or if you’re building optical instrumentation. Scroll through for the key equations, a step-by-step portrait example, a basic sample, and answers to common questions.
What is Depth of Field?
Depth of field is just the range in front of your lens where things look sharp enough for practical purposes. Anything inside that range will look focused; anything outside will blur progressively more.
Simple Explanation
Picture depth of field as a sharpness “slice” sitting somewhere in front of your lens—objects inside that slice are crisp, outside are blurred. A wide aperture (say f/1.8) makes the slice very thin; this isolates your subject well but blurs everything else. Stop down to f/11, and the slice thickens, bringing more of the scene into acceptable focus. Where that slice starts and ends depends on the distance to your subject and the lens’s focal length.
📐 Browse all 1000+ Interactive Calculators
Quick Navigation
System Diagram
Depth of Field Interactive Calculator
How to Use This Calculator
This calculator is intended for education, concept evaluation, and preliminary design. Results are based on the equations and assumptions described on this page, but cannot account for every real-world load case, tolerance, material property, environmental condition, installation detail, safety factor, code, or regulatory requirement. Verify all inputs, assumptions, units, and results independently before selecting components or using the result in a real application. Safety-critical, structural, medical, lifting, transportation, or regulated applications must be reviewed by a qualified engineer.
- Choose which value you want to calculate—depth of field, hyperfocal distance, circle of confusion, or required aperture, distance, or focal length for a target DoF.
- Input your camera and lens information—focal length (mm), aperture (f-number), subject distance (m), and sensor width (mm). Reference sensor sizes are in the hints.
- If you need to, enter your required DoF (m)—mainly for aperture, distance, and focal length calculation modes.
- Click Calculate to get your result.
Simple Example
Mode: Calculate Depth of Field
Focal length: 50 mm | Aperture: f/2.8 | Subject distance: 3 m | Sensor width: 36 mm (full-frame)
Result: Near limit ≈ 2.77 m | Far limit ≈ 3.26 m | Total DoF ≈ 0.49 m
Depth of Field Interactive Visualizer
Move the sliders for focal length, aperture, and subject distance, and you'll see immediately how the sharp focus zone widens or narrows as camera settings change. This offers a direct look at how much you are actually gaining or losing every time you tweak your lens or working distance.
NEAR LIMIT
2.77m
TOTAL DOF
0.49m
FAR LIMIT
3.26m
FIRGELLI Automations — Interactive Engineering Calculators
Governing Equations
If you need the size of a just-barely-acceptable blur circle on the sensor, here’s how to calculate it.
Circle of Confusion (CoC)
c = d / 1500
c = circle of confusion (mm)
d = sensor diagonal or width (mm)
The divisor 1500 represents approximately 1/1500 of the sensor dimension as the acceptable blur diameter
The hyperfocal distance is the focus setting where you get the largest possible in-focus zone—from half of that distance all the way to infinity.
Hyperfocal Distance
H = f² / (N × c) + f
H = hyperfocal distance (mm)
f = focal length (mm)
N = f-number (aperture)
c = circle of confusion (mm)
When focused at the hyperfocal distance, depth of field extends from H/2 to infinity
For the nearest object that still looks sharp, use this formula:
Near Focus Limit
Dn = (s × H) / (H + s)
Dn = near focus limit (mm)
s = subject distance (mm)
H = hyperfocal distance (mm)
Objects closer than Dn will appear unacceptably blurred
And for the furthest object still in focus, use this:
Far Focus Limit
Df = (s × H) / (H - s)
Df = far focus limit (mm)
s = subject distance (mm)
H = hyperfocal distance (mm)
When s ≥ H, the far limit extends to infinity (Df = ∞)
To find the depth of field, just subtract near from far limit:
Total Depth of Field
DoF = Df - Dn
DoF = total depth of field (mm)
Df = far focus limit (mm)
Dn = near focus limit (mm)
The range within which objects appear acceptably sharp in the final image
Theory & Engineering Applications
Depth of field sets the practical limits of sharpness in real imaging systems. The thin lens equation idealizes perfect focus on a flat plane, but in reality, sharpness drops off gradually on either side of that plane. What counts as “acceptably sharp” is defined by the circle of confusion, which boils down to how much blur you can actually tolerate—set by sensor size, how the image will be viewed, and what you need to see in the final result.
The Physics of Defocus and Circle of Confusion
Any point source, when not focused exactly, hits your sensor as a small disk instead of a pure point. That blur circle grows as you move away from the focus plane. The allowable size of that blur (the circle of confusion) makes or breaks the result and is often defined as about 1/1500 of the sensor width in classic photography, though you'll need to tighten up that limit if you intend to inspect with higher resolution or digital enlargement.
The usual CoC calculation, c = sensor_width / 1500, traces back to film standards where images were viewed at a certain print size and distance. Today, with much higher resolution and digital zoom, you sometimes need to use a stricter (smaller) CoC—divide by 2000 or 2500 for critical digital or inspection jobs.
Hyperfocal Distance and Optimization Strategies
Focusing at the hyperfocal distance buys you the widest possible sharp zone, from half of H out to infinity. This is especially useful if you’re trying to get everything from foreground to the background in focus—think landscapes, reference imaging, or any fixed-focus setup.
H = f²/(N·c) + f doesn’t just scale in an obvious way: if you double the focal length, the hyperfocal distance quadruples, which means a lot less depth of field if you reach for a telephoto. Stopping down the aperture (higher N) does pull the hyperfocal closer, but after a point (often f/16 or smaller for full-frame), diffraction will soften your details enough that the extra DoF isn’t worth it.
Asymmetric Depth Distribution
Depth of field doesn’t split evenly around the subject. Usually, you get about one-third in front of your focus point and two-thirds behind, but this is a ballpark figure. The exact ratio depends on the subject distance and how close it is to the hyperfocal; the “two-thirds behind” rule breaks down at macro distances (where it gets close to 1:1) or as the subject distance nears H (where far DoF extends to infinity).
This happens because the near and far limit calculations are fundamentally non-linear; as you approach the hyperfocal distance, the far focus limit heads quickly toward infinity, leaving you with all your DoF at the rear. This is worth remembering for both practical focus stacking and scene depth planning—especially for macro or scenes where you care about even sharpness.
Machine Vision and Industrial Applications
Machine vision work puts stricter demands on depth of field. Here, you usually need an entire part or inspection volume to land within the focused zone, and you may be chasing sub-millimeter detail. Balancing DoF means trade-offs: small apertures give more depth but starve your sensor for light and degrade resolution by diffraction, especially for higher-magnification or low-light setups.
If you need dimensionally precise or perspective-free measurements across a depth range, telecentric lenses help—they keep magnification constant within the DoF, but you give up working distance and pay for larger, more complex optics. On a typical setup (0.1× telecentric lens, f/8), you might get 12-15mm of DoF across a 50mm field, which is usually workable for small-part inspection.
Cinematography and Bokeh Control
Control of depth of field is a basic creative lever in cinema. Large sensors and wide apertures throw backgrounds well out of focus with the right setup—a 50mm at f/1.4 on a full-frame, focused at 2 meters, only nets about 77mm in-focus, so you need to be precise with focus pulls. The way out-of-focus areas look (“bokeh”) isn’t just about how much is blurred, but the lens’s aperture blade geometry and its optical corrections, which affect the quality of the blur.
More aperture blades means rounder blur circles; fewer means polygonal shapes. Some lens designs even introduce soap-bubble edges or concentrate light toward the middle of the bokeh. High-end cinema optics may offer different blade shapes to give a signature look, but mechanically, it’s all about how circles of confusion vary outside the focus plane.
Worked Example: Portrait Photography System Design
Let’s build up a system for a portrait photographer who wants subject separation but consistent sharpness across a face. With a full-frame sensor (36mm width), 85mm focal length, 3m distance, and ±150mm allowed blur (face depth):
Step 1: Calculate circle of confusion
c = 36 / 1500 = 0.024 mm
Step 2: Determine required depth of field
Target DoF = 300mm = 0.3 m
This keeps nose to ears crisp.
Step 3: Calculate required aperture
Solve for N (aperture). Use:
DoF ≈ (2 × N × c × s²) / (f² - N × c × s)
For s ≫ f, this holds up.
Rearrange and solve. Result is N ≈ 4.78
So, f/4.5 to f/5.0 is practical.
Step 4: Calculate actual depth of field at f/5.0
H = (85² / (5.0 × 0.024)) + 85 = ~60.3m
Dn = 2.858m; Df = 3.157m
Total DoF ≈ 299mm
Step 5: Verify background blur at 5.0m
Objects at 5m will be so far out of focus that the blur circle is huge compared to the acceptable limit, so the background is definitely blurred.
Practical considerations: At f/5.0, diffraction isn’t a problem and there’s enough light for studio or outdoor use. The DoF covers typical human head depth, leaving some room for subject or focus drift.
All this highlights the value of running the numbers: you can explicitly build the sharpness and isolation you want—not just guess, but work it out and set up in the field accordingly.
For more tools and design references, see the FIRGELLI engineering calculator library.
Practical Applications
Scenario: Quality Control Engineer Optimizing Machine Vision System
Marcus has to inspect crankshaft bearing journals and needs to see defects down to 0.15mm. The part height can vary by ±8mm. With a 35mm lens, working at 285mm and f/11 on an 8.9mm sensor (CoC = 0.016mm), the calculator gives him 16.2mm of DoF—enough to cover the height change and still spot those scratches. He sees that his earlier f/5.6 setting only delivered 7.4mm DoF, which explains why not all defects were caught across the part range.
Scenario: Wildlife Photographer Planning Safari Equipment
Elena wants to know if her 600mm f/4 will keep lions sharp from nose to tail on safari. At 25m and f/5.6 (full-frame, 36mm sensor), she gets 1.83m of DoF—just enough for a lion’s length. For scenes with several animals at staggered depths, stopping down to f/8 gets her 2.58m, and f/11 gets 3.58m, but at the cost of background isolation. She uses this to plan which aperture suits the situation, weighing sharpness against subject isolation.
Scenario: Cinematographer Designing Rack Focus Shot
James has to pull focus from a face at 1.2m to a doorway at 8m on a Super35 (24.6mm sensor) camera with a 50mm at T2.1. He checks and finds only 41mm DoF at the near end—very tight margin for focus pulling. At the far end, 1.87m DoF gives a bit more slack. The calculator also confirms there’s no point focusing at infinity for this shot. He uses these distances to physically mark the lens and prep his crew, so there are no surprises during filming.
Frequently Asked Questions
Why does depth of field extend farther behind the focus point than in front? +
How does sensor size affect depth of field and circle of confusion? +
What is the relationship between depth of field and diffraction limits? +
How accurate are depth of field calculations in practice? +
What is hyperfocal focusing and when should it be used? +
How do teleconverters and extension tubes affect depth of field? +
Free Engineering Calculators
Explore our complete library of free engineering and physics calculators.
Browse All Calculators →🔗 Explore More Free Engineering Calculators
About the Author
Robbie Dickson — Chief Engineer & Founder, FIRGELLI Automations
Robbie Dickson brings over two decades of engineering expertise to FIRGELLI Automations. With a distinguished career at Rolls-Royce, BMW, and Ford, he has deep expertise in mechanical systems, actuator technology, and precision engineering.
Video Walkthrough - How to Use This Calculator
Need to implement these calculations?
Explore the precision-engineered motion control solutions used by top engineers.
