Depth of Field & Hyperfocal Distance Calculator
Results:
Near Limit: —
Far Limit: —
Total Depth of Field: —
Hyperfocal Distance: —
Error:
Please enter valid positive numbers for all fields."; return; } // Convert focal length and circle of confusion to meters for consistent calculation units // Or, convert subject distance to mm and keep f and c in mm. Let's use mm for f and c, and convert S to mm. var f_mm = focalLength; // Focal length in mm var N = aperture; // Aperture f-number var c_mm = circleOfConfusion; // Circle of Confusion in mm var S_mm = subjectDistance * 1000; // Subject distance in mm // Calculate Hyperfocal Distance (H) in mm // H = (f^2 / (N * c)) var H_mm = (f_mm * f_mm) / (N * c_mm); // Calculate Near Limit (Dn) in mm // Dn = (H * S) / (H + S) var Dn_mm = (H_mm * S_mm) / (H_mm + S_mm); // Calculate Far Limit (Df) in mm // Df = (H * S) / (H – S) var Df_mm; if (S_mm >= H_mm) { Df_mm = Infinity; } else { Df_mm = (H_mm * S_mm) / (H_mm – S_mm); } // Convert results back to meters for display var H_m = H_mm / 1000; var Dn_m = Dn_mm / 1000; var Df_m = (Df_mm === Infinity) ? Infinity : Df_mm / 1000; // Calculate Total Depth of Field var totalDoF_m; if (Df_m === Infinity) { totalDoF_m = Infinity; } else { totalDoF_m = Df_m – Dn_m; } // Display results document.getElementById("nearLimit").innerHTML = "Near Limit: " + Dn_m.toFixed(2) + " meters"; document.getElementById("farLimit").innerHTML = "Far Limit: " + (Df_m === Infinity ? "Infinity" : Df_m.toFixed(2) + " meters"); document.getElementById("totalDoF").innerHTML = "Total Depth of Field: " + (totalDoF_m === Infinity ? "Infinity" : totalDoF_m.toFixed(2) + " meters"); document.getElementById("hyperfocalDistance").innerHTML = "Hyperfocal Distance: " + H_m.toFixed(2) + " meters"; }Understanding Depth of Field and Hyperfocal Distance in Photography
Depth of Field (DoF) is one of the most fundamental concepts in photography, determining how much of your image appears acceptably sharp. It refers to the range of distances in front of and behind your subject that are in focus. A shallow DoF isolates your subject from a blurry background (bokeh), while a deep DoF keeps everything from foreground to background sharp.
What Influences Depth of Field?
Several factors work together to control the depth of field in your photographs:
- Aperture (f-number): This is the most significant control. A wider aperture (smaller f-number like f/1.8, f/2.8) results in a shallower DoF, while a narrower aperture (larger f-number like f/11, f/16) produces a deeper DoF.
- Focal Length: Longer focal lengths (e.g., 200mm telephoto) tend to produce a shallower DoF compared to shorter focal lengths (e.g., 24mm wide-angle) at the same aperture and subject distance.
- Subject Distance: The closer your camera is to your subject, the shallower the DoF will be. Conversely, moving further away from your subject increases the DoF.
- Circle of Confusion (CoC): This is a more technical factor related to your camera's sensor size and the acceptable level of blur before it's perceived as out of focus. A smaller CoC (typical for smaller sensors or higher resolution demands) results in a shallower DoF. The calculator provides common CoC values for different sensor sizes.
What is Hyperfocal Distance?
Hyperfocal distance is a critical concept for landscape photographers or anyone aiming for maximum sharpness from foreground to infinity. It is the closest distance at which a lens can be focused while keeping objects at infinity acceptably sharp. When you focus your lens at the hyperfocal distance, everything from half of that distance out to infinity will appear acceptably sharp.
Knowing the hyperfocal distance allows you to achieve the deepest possible depth of field for a given focal length and aperture, without needing to focus on infinity itself.
How to Use the Depth of Field Calculator:
This calculator helps you predict the depth of field and hyperfocal distance for your specific camera and lens setup:
- Focal Length (mm): Enter the focal length of your lens (e.g., 50mm, 85mm, 200mm).
- Aperture (f-number): Input the f-stop you plan to use (e.g., f/2.8, f/8, f/16).
- Subject Distance (meters): Enter the distance from your camera to your main subject in meters.
- Circle of Confusion (mm): This value depends on your camera's sensor size. Use the provided common values as a guide, or look up the precise CoC for your specific camera model.
- Click "Calculate Depth of Field" to see the results.
Understanding the Results:
- Near Limit: The closest point to the camera that will appear acceptably sharp.
- Far Limit: The furthest point from the camera that will appear acceptably sharp. If this shows "Infinity," it means everything from the near limit onwards will be in focus.
- Total Depth of Field: The total range (in meters) between the near and far limits that is in focus.
- Hyperfocal Distance: The distance you should focus your lens to achieve maximum depth of field, extending from half that distance to infinity.
Practical Examples:
Let's consider a full-frame camera (CoC = 0.029mm):
- Example 1: Portrait Photography (Shallow DoF)
- Focal Length: 85mm
- Aperture: f/1.8
- Subject Distance: 3 meters
- Result: You'll likely find a very shallow DoF, perhaps only a few centimeters, perfect for isolating your subject.
- Example 2: Landscape Photography (Deep DoF)
- Focal Length: 24mm
- Aperture: f/11
- Subject Distance: 5 meters
- Result: The calculator might show a near limit of a few meters and a far limit of infinity, indicating a very deep DoF suitable for landscapes. The hyperfocal distance will also be relatively close, allowing you to focus there for maximum sharpness.
- Example 3: Street Photography
- Focal Length: 35mm
- Aperture: f/5.6
- Subject Distance: 7 meters
- Result: A moderate DoF, keeping a reasonable range in focus for candid shots without everything being tack sharp.
Experiment with different values in the calculator to see how each setting impacts your depth of field and hyperfocal distance, helping you make more informed creative decisions in your photography.