FREE TOOL: Nail Your Focus Every Time – Try Our Free Depth of Field Calculator

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.

Depth of Field Calculator

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:

  1. Enter your focal length (mm).
  2. Set the aperture (f-number).
  3. Enter the subject distance.
  4. Choose units (m / ft / cm / mm / in).
  5. Select your sensor / format.
  6. Read the near limit, far limit, and total DOF.
  7. 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.03mm scaled 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.

AttributeValuesDefaultWhat it does
data-titleAny textDIYPhotography.net Depth of Field CalculatorSets the visible header title.
data-unitsm | ft | cm | mm | inmSets the starting units for subject distance and results.
data-formatff | aps15 | aps16 | mft | mfffSets the starting sensor/format (affects circle of confusion).
data-themelight | darklightChooses 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-calculator to reduce conflicts.
  • Multiple instances: the script auto-initialises any .diyp-dof-calculator it finds on page load.
  • Performance: no network calls after the CSS/JS files load; everything runs in the browser.

Filed Under:

Tagged With:

Find this interesting? Share it with your friends!

John Aldred

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.

Leave a Reply

Your email address will not be published. Required fields are marked *