ForHosting KIT · Images

Estimate photography depth of field near and far limits

A 50 mm lens at f/8 focused at 5 m, with a 0.03 mm circle of confusion, keeps things sharp from just under three and a half metres to just over nine and a half. You also get the hyperfocal distance. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Focal length mm
50
Aperture
8
Focus distance m
5
Circle of confusion mm
0.03
You get
Near limit m
3.389370933
Far limit m
9.527439024
Hyperfocal distance m
10.466666667

This photography depth-of-field estimator calculates the near and far boundaries that are expected to appear acceptably sharp around a chosen focus distance. Supply the lens focal length, aperture, subject focus distance, and circle of confusion, and it applies the standard photographic depth-of-field equations. Results are returned in metres, including the hyperfocal distance and a clear flag when the far boundary extends to infinity. The calculation is deterministic and suitable for planning photographs, checking camera applications, or comparing lens settings. It is an optical estimate rather than a promise about every final image, because viewing size, eyesight, lens behaviour, diffraction, and output sharpening can also influence perceived sharpness.

Understand the four inputs before calculating

Begin with the actual focal length marked on the lens, expressed in millimetres. Do not multiply it by crop factor: crop factor may influence the circle of confusion you choose, but it does not change the physical focal length used by the formula. Enter aperture as the f-number, so a value such as 2.8 represents f/2.8 and 11 represents f/11.

Focus distance is measured from the camera's image plane to the plane on which the lens is focused, not necessarily from the front of the lens. This estimator accepts that distance in metres. Finally, choose a circle of confusion in millimetres.

That value represents the largest blur circle treated as acceptably sharp under an assumed viewing condition. A commonly used value for 35 mm full-frame photography is 0.03 mm, while smaller formats often use smaller values. These are conventions, not universal physical limits.

All four values must be positive finite numbers, and the focus plane must lie beyond the focal length. In particular, a zero or negative focal length is rejected instead of being silently corrected, because it cannot describe a valid photographic lens input for this calculation.

Read the near, far, and hyperfocal results

The estimator first calculates hyperfocal distance H using H = f squared divided by N times c, plus f, with all lengths expressed in millimetres. It then calculates the near limit from the focus distance and hyperfocal distance. The far limit uses a related fraction while the focus distance remains below H.

When the camera is focused at or beyond the calculated hyperfocal distance, the mathematical far boundary is infinite. Depth of field is the range between the near and far boundaries, but the transition into blur is gradual rather than a hard wall. A subject just outside a boundary does not suddenly become unusable; it simply exceeds the selected circle-of-confusion criterion under its assumed viewing conditions.

Use the figures as repeatable planning estimates, then examine important photographs at their intended display size.

Apply the estimate to real photographic decisions

For a portrait, start with the focal length, aperture, and approximate camera-to-eye distance you expect to use. Compare the returned interval with the depth of the face or with the spacing between people in a group. If the interval is too narrow, stop down, move the camera farther away while reframing, or reconsider the focus point.

Focusing at the nearest object is not always the best choice; placing focus nearer the hyperfocal distance can keep a foreground feature within the acceptable range while extending the far boundary to infinity. Product photographers can use the same calculation to decide whether a single exposure may cover an object or whether focus stacking is worth considering. Remember that this model does not calculate diffraction, lens aberrations, subject motion, camera shake, field curvature, or focus breathing.

Macro work can also require a model based on magnification rather than the ordinary distance formulas used here. Validate unusual setups with a test frame before relying on the estimate for a one-time shot.

Plan a portrait session

Estimate whether the eyes and other important facial details fit inside the acceptable sharpness range at the intended aperture and distance.

Choose a landscape focus point

Compare the near boundary and hyperfocal distance before balancing foreground detail against a far boundary that reaches infinity.

Should I apply crop factor to focal length?

No. Enter the lens's actual focal length. Choose a circle of confusion appropriate to the sensor format and viewing assumptions instead.

What circle of confusion should I enter?

Use the value appropriate to your sensor format and intended viewing conditions. A traditional full-frame convention is 0.03 mm, but stricter viewing requires a smaller value.

Does this predict exact visible sharpness?

No. It estimates acceptable sharpness under a circle-of-confusion criterion; diffraction, motion, lens performance, processing, display size, and eyesight also matter.

What is the hyperfocal distance?

It is the focus distance at which the far limit of sharpness reaches infinity. Focus there or beyond and everything from the near limit to the horizon counts as acceptably sharp, which is why landscape photographers check it.

Where is the focus distance measured from?

From the camera's image plane, where the sensor or film sits, to the plane the lens is focused on, and not necessarily from the front of the lens. Enter it in metres.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/image/depth-of-field-estimate

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/image/depth-of-field-estimate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"focal_length_mm":50,"aperture":8,"focus_distance_m":5,"circle_of_confusion_mm":0.03}'
{
  "focal_length_mm": 50,
  "aperture": 8,
  "focus_distance_m": 5,
  "circle_of_confusion_mm": 0.03
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "image.depth_of_field_estimate",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb15
max_megapixels12
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the near, far, and hyperfocal results

JSON cannot represent mathematical infinity safely, so the response sets far_limit_m to null and far_limit_infinite to true. This pairing is deliberate and lets software distinguish infinity from missing data. The returned near_limit_m and finite far_limit_m are rounded to nine decimal places for stable output, while hyperfocal_distance_m helps you understand why the boundary behaves as it does.

Apply the estimate to real photographic decisions

For landscapes, compare the desired foreground distance with near_limit_m and note whether far_limit_infinite is true. For automation, each successful request costs $0.002, produces the same result for the same values, and uses no network data or random choices.

Test photography software

Generate deterministic near and far limits for regression tests in camera, lens-planning, education, or metadata applications.

Why is the far limit sometimes null?

A null far_limit_m accompanied by far_limit_infinite set to true means the standard formula places the far boundary at infinity.

What does an API request cost?

Each successful API request costs $0.002. The calculation uses deterministic local arithmetic and no external network service.

Read the full KIT documentation →