# Depth of Field Calculator

> Computes the near and far limits of acceptable sharpness, the total depth of field and the hyperfocal distance from focal length, f-number, focus distance and the sensor's circle of confusion, using the standard thin-lens depth-of-field equations.

- Calculator id: `depth-of-field` · Category: Photography & Optics (`photography`) · Tool name: `calculate_depth_of_field`
- Canonical page: https://tttkmbb.com/photography/depth-of-field · This document: https://tttkmbb.com/photography/depth-of-field.md · JSON definition: https://tttkmbb.com/photography/depth-of-field.json

## Purpose

Computes the near and far limits of acceptable sharpness, the total depth of field and the hyperfocal distance from focal length, f-number, focus distance and the sensor's circle of confusion, using the standard thin-lens depth-of-field equations.

**Use when:** You need to know how much of a scene is acceptably sharp for given camera settings, or how far sharpness extends in front of and behind the focused subject.

**Do not use when:** You only need the focus distance that maximises depth of field (use hyperfocal-distance), or you shoot macro above about 0.2× magnification where lens extension and pupil magnification make the thin-lens equations inaccurate.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `focal_length_mm` | number | mm | required | Actual (not equivalent) focal length of the lens in millimetres. (min 1, max 5000) |
| `aperture_f` | number |  | required | Lens f-number, e.g. 2.8 for f/2.8. (min 0.5, max 128) |
| `focus_distance_m` | number | m | required | Distance from the camera's sensor plane to the focused subject in metres. (> 0, max 100000) |
| `sensor` | enum: full_frame \| aps_c \| aps_c_canon \| micro_four_thirds \| one_inch \| medium_format_44x33 \| smartphone_1_over_2_3 |  | optional, default "full_frame" | Sensor format; selects the circle of confusion (0.030 mm full frame, 0.020 mm APS-C, 0.015 mm Micro Four Thirds ...). |
| `coc_mm` | number | mm | optional | Optional acceptable circle-of-confusion diameter; overrides the preset value (full frame 0.030, APS-C 0.020, Micro Four Thirds 0.015, 1-inch 0.011 mm). (> 0, max 1) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `hyperfocal_m` | number | m | H = f²/(N·c) + f: focusing here gives sharpness from H/2 to infinity. |
| `near_limit_m` | number | m | Closest distance that is acceptably sharp. |
| `far_limit_m` | number | m | Farthest distance that is acceptably sharp; omitted when it is infinite (see far_limit_text). |
| `far_limit_text` | string |  | Far limit as text, 'infinity' when the focus distance is at or beyond the hyperfocal distance. |
| `total_dof_m` | number | m | far − near; omitted when the far limit is infinite. |
| `in_front_of_subject_m` | number | m | focus_distance − near limit. |
| `behind_subject_m` | number | m | far limit − focus_distance; omitted when infinite. |
| `coc_used_mm` | number | mm | Circle of confusion diameter applied (preset or override). |

## Formula

`H = f² / (N·c) + f; near = s·(H − f) / (H + s − 2f); far = s·(H − f) / (H − s) when s < H, otherwise infinity (f = focal_length_mm, N = aperture_f, c = coc_mm, s = focus_distance_m × 1000, all in mm)`

Thin-lens approximation with a sensor-dependent circle of confusion (diagonal / 1500 convention). Lens makers and apps use slightly different CoC values, so limits can differ by 10–20 %; distances are measured from the sensor plane.

## Data Sources

- Wikipedia – Depth of field — https://en.wikipedia.org/wiki/Depth_of_field (reference, retrieved 2026-09-24)
- Wikipedia – Circle of confusion — https://en.wikipedia.org/wiki/Circle_of_confusion (reference, retrieved 2026-09-24)
- Cambridge in Colour – Understanding depth of field — https://www.cambridgeincolour.com/tutorials/depth-of-field.htm (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/depth-of-field?focal_length_mm=…&aperture_f=…&focus_distance_m=…`
- `POST https://tttkmbb.com/api/v1/calculate/depth-of-field` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/depth-of-field · OpenAPI operationId `calculate_depth_of_field` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool: `calculate_depth_of_field` (dedicated) or `run_calculator` with `{"calculator_id": "depth-of-field", "inputs": {…}}`

## Example

- 50 mm, f/2.8, focused at 3 m, full frame: inputs `{"focal_length_mm":50,"aperture_f":2.8,"focus_distance_m":3,"sensor":"full_frame"}` → `{"hyperfocal_m":29.812,"near_limit_m":2.729,"far_limit_m":3.33,"total_dof_m":0.601,"coc_used_mm":0.03}`
- 24 mm, f/8, focused at 5 m, full frame (beyond hyperfocal): inputs `{"focal_length_mm":24,"aperture_f":8,"focus_distance_m":5,"sensor":"full_frame"}` → `{"hyperfocal_m":2.424,"near_limit_m":1.627,"far_limit_text":"infinity","in_front_of_subject_m":3.373}`

```
GET https://tttkmbb.com/api/v1/calculate/depth-of-field?focal_length_mm=50&aperture_f=2.8&focus_distance_m=3&sensor=full_frame
```

## Limitations

You only need the focus distance that maximises depth of field (use hyperfocal-distance), or you shoot macro above about 0.2× magnification where lens extension and pupil magnification make the thin-lens equations inaccurate. Thin-lens approximation with a sensor-dependent circle of confusion (diagonal / 1500 convention). Lens makers and apps use slightly different CoC values, so limits can differ by 10–20 %; distances are measured from the sensor plane. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Why does the sensor size change the depth of field?**

Smaller sensors are enlarged more for the same print, so the acceptable blur (circle of confusion) is smaller: 0.020 mm for APS-C versus 0.030 mm for full frame. For the same lens and settings that shrinks the depth of field slightly.

**Why is the far limit 'infinity'?**

When the focus distance is at or beyond the hyperfocal distance H, everything from the near limit to infinity is acceptably sharp, so the far limit and total depth of field are unbounded.

**Is the 1/3 in front, 2/3 behind rule built in?**

No, the split is computed exactly; it is close to 1/3–2/3 only at moderate distances and approaches 1/2–1/2 in macro range and 'to infinity' near the hyperfocal distance.

## Related

- [Hyperfocal Distance Calculator](https://tttkmbb.com/photography/hyperfocal-distance.md) — Focus distance that gives sharpness from half that distance to infinity.
- [Field of View Calculator](https://tttkmbb.com/photography/field-of-view.md) — Angle of view and frame coverage for the same lens and sensor.
- [Crop Factor Calculator](https://tttkmbb.com/photography/crop-factor.md) — Sensor diagonal, crop factor and equivalent aperture for depth of field.
