FREE TOOL: Nail Your Focus Every Time – Try Our Free Depth of Field Calculator
Jan 7, 2026
Share:

Not sure how much of your image will actually be in focus? Depth of field depends on aperture, focal length, sensor size, and distance to your subject. Use this calculator to see how those settings affect what appears sharp, and to find the balance between background blur and usable focus.
How to use the calculator:
- Enter your focal length (mm).
- Set the aperture (f-number).
- Enter the subject distance.
- Choose units (m / ft / cm / mm / in).
- Select your sensor / format.
- Read the near limit, far limit, and total DOF.
- Use Copy result if you want to paste the values into notes or a shooting plan.
Depth of field (quick explainer)
- Near limit is the closest distance that still looks acceptably sharp.
- Far limit is the furthest distance that still looks acceptably sharp (it may be ∞).
- Total DOF is the distance between the near and far limits.
- Depth of field depends on focal length, aperture, distance, and a circle of confusion assumption tied to your selected format. This tool estimates CoC using crop factor (FF baseline
0.03mmscaled by format).
For website owners: embed this on your site
Quick start
Paste this where you want the calculator to appear (WordPress “Custom HTML” block is fine):
<div class="diyp-dof-calculator"></div>
<link rel="stylesheet" href="https://www.diyphotography.net/diyptools/diyp-dof-calc.min.css">
<script src="https://www.diyphotography.net/diyptools/diyp-dof-calc.min.js" async defer></script>
You can add multiple calculators on a page—just add more <div class="diyp-dof-calculator"> blocks. All logic runs client-side.
Optional parameters (data-attributes)
Add these to the <div class="diyp-dof-calculator"> to set defaults or theme.
| Attribute | Values | Default | What it does |
|---|---|---|---|
data-title | Any text | DIYPhotography.net Depth of Field Calculator | Sets the visible header title. |
data-units | m | ft | cm | mm | in | m | Sets the starting units for subject distance and results. |
data-format | ff | aps15 | aps16 | mft | mf | ff | Sets the starting sensor/format (affects circle of confusion). |
data-theme | light | dark | light | Chooses the color theme. |
Examples
Dark theme, feet, APS-C 1.5×:
<div class="diyp-dof-calculator" data-theme="dark" data-units="ft" data-format="aps15"></div>
Custom title:
<div class="diyp-dof-calculator" data-title="Acme Lab — DOF Helper"></div>
Notes for embedders
- Distance math: all internal calculations are done in millimetres; the tool converts to/from your chosen units for input/output.
- Far limit: if the far limit reaches infinity, the tool shows ∞ and total DOF as ∞.
- Circle of confusion: estimated from crop factor using a full-frame baseline of
0.03mm(CoC = 0.03 / crop). - Rounding: displayed values are formatted to 2 decimals.
- Styling: CSS is namespaced under
.diyp-dof-calculatorto reduce conflicts. - Multiple instances: the script auto-initialises any
.diyp-dof-calculatorit finds on page load. - Performance: no network calls after the CSS/JS files load; everything runs in the browser.
John Aldred
John Aldred is a photographer with over 25 years of experience in the portrait and commercial worlds. He is based in Scotland and has been an early adopter – and occasional beta tester – of almost every digital imaging technology in that time. As well as his creative visual work, John uses 3D printing, electronics and programming to create his own photography and filmmaking tools and consults for a number of brands across the industry.




































Join the Discussion
DIYP Comment Policy
Be nice, be on-topic, no personal information or flames.