Focus stacking frame count calculator
A subject 30 mm deep with 4 mm of depth of field per shot and 0.25 overlap needs 10 frames at 3 mm steps: enter depth, depth of field and overlap before you start the rail or turn the focus ring. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Subject depth
- 30
- Dof per shot
- 4
- Overlap
- 0.25
- Step size
- 3
- Frame count
- 10
- Focus steps
- 9
- Total covered
- 31
Focus stacking merges several shots focused at different distances so the final image is sharp through a subject thicker than one frame of depth of field. The practical question before you start the rail or the focus ring is how many frames you actually need. This calculator answers that with three numbers: the subject depth you must cover, the depth of field each focused shot delivers at your chosen aperture and magnification, and the fractional overlap you want between consecutive zones so soft edges do not leave gaps. It returns the frame count, the focus step size, how many steps separate the first and last plane, and the total depth the planned stack covers.
How frame count follows from DOF, depth, and overlap
Each focused frame is acceptably sharp over a depth of field interval of length D. If consecutive frames were placed end to end with no overlap, the focus step would equal D and thin misalignments or field curvature could leave unsharp bands between planes. Photographers therefore step the focus by less than D: with fractional overlap O in the half-open interval from zero inclusive to one exclusive, the effective step size is step equals D times one minus O.
Zero overlap means you advance a full DOF; an overlap of one quarter means each new plane reuses twenty-five percent of the previous sharp zone and the step is three quarters of D. Given a subject depth S measured in the same length unit as D, a single frame is enough whenever S is less than or equal to D.
When S is larger, the remaining depth after the first frame is S minus D, and you need enough additional steps of size step to cover that remainder, which yields frame count equals the ceiling of (S minus D) divided by step, plus one. The total covered depth is then D plus (frame count minus one) times step, which is always at least S under this model.
The calculator does not invent D from optics; you supply D from a depth-of-field table, a field test, or a separate DOF tool such as the kit depth-of-field calculator. It also does not choose O for you: macro and product work often use twenty to forty percent overlap for safety, while careful studio stacks with a solid rail may run lower.
Units cancel as long as S and D match—millimetres for insects and jewellery, centimetres or metres for larger still-life depths—because only their ratio and the dimensionless overlap enter the count.
Practical stacking tips and related searches
Measure subject depth along the optical axis from the nearest surface that must be sharp to the farthest, not the physical width of the object on the table. Obtain DOF per shot at the working magnification and aperture you will actually use; stopping down widens each zone and can cut frame count dramatically, but diffraction and longer exposure times trade against that gain.
Prefer a fixed percentage overlap across a series so automated rails and software assume a constant step; if light or composition forces an aperture change mid-stack, recompute both DOF and frame count rather than trusting the first plan. When teaching, pair examples: depth equal to DOF yields one frame; depth slightly larger than DOF with twenty-five percent overlap yields two; and a deep macro subject with thin DOF produces a large but finite count you can compare against rail travel limits.
This landing targets people searching for a focus stacking frame count calculator, how many frames for a focus bracket, DOF overlap for macro stacks, or focus rail step planning; it is not a focus-merge application, not a diffraction blur estimator, and not a substitute for computing depth of field from focal length and circle of confusion.
Prefer this capability when you already know subject depth, per-shot DOF, and desired overlap and only need the frame count and step size; if you still need near and far limits from lens parameters, run a depth-of-field calculator first.
What you can do with it
Macro insect and jewellery stacks
Macro shooters enter measured subject depth in millimetres, DOF at the working f-stop, and a safety overlap to size the rail travel and shutter count before the light changes.
Product and tabletop still life
Studio product teams plan how many focus brackets a bottle or shoe needs at a chosen aperture so tethered capture scripts allocate buffer and time correctly.
Teaching focus-stacking math
Camera clubs and course authors generate known-good frame counts plus deliberate invalid inputs for worksheets and automated grading of stacking homework.
FAQ
How is the focus step size calculated?
With 25% overlap the step is 75% of each frame’s depth of field.
When is only one frame required?
The subject already fits inside a single sharp zone.
Why is overlap of 1.0 rejected?
Full overlap would make the focus step zero, so the stack never advances. Use a fraction strictly less than 1.
Is the calculator free?
The browser tool is free and runs locally.
How many frames do I need for a 30 mm deep subject?
With 4 mm of depth of field per shot and an overlap of 0.25, the step is 3 mm and you need 10 frames, 9 focus moves, covering 31 mm in total.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/hobby/photo-focus-stack-frames \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"subject_depth":30,"dof_per_shot":4,"overlap":0.25}'const res = await fetch("https://api.kit.forhosting.com/hobby/photo-focus-stack-frames", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"subject_depth": 30,
"dof_per_shot": 4,
"overlap": 0.25
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/hobby/photo-focus-stack-frames",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"subject_depth": 30,
"dof_per_shot": 4,
"overlap": 0.25
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/hobby/photo-focus-stack-frames", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"subject_depth":30,"dof_per_shot":4,"overlap":0.25}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"subject_depth":30,"dof_per_shot":4,"overlap":0.25}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/hobby/photo-focus-stack-frames", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"subject_depth": 30,
"dof_per_shot": 4,
"overlap": 0.25
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "hobby.photo_focus_stack_frames",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How to call the API and read the response
Send a JSON body with three required finite numbers: subject_depth (aliases depth, subject_depth_mm, total_depth, stack_depth), dof_per_shot (aliases dof, depth_of_field, dof_mm, single_dof), and overlap (aliases overlap_fraction, step_overlap, overlap_ratio). subject_depth and dof_per_shot must be strictly positive lengths in the same unit; overlap must lie in the closed-open interval from zero to one so the step size stays positive. Missing fields, non-numeric strings, NaN, Infinity, zero or negative depths, and overlap values of one or greater fail with invalid_input and are never charged. On success the response echoes rounded subject_depth, dof_per_shot, and overlap; sets step_size to D times (one minus O); sets frame_count to the integer number of frames; sets focus_steps to frame_count minus one; sets total_covered to the depth the planned stack actually spans; and includes unit_note, formula, message, and an ordered steps array of substitution lines for teaching and regression checks. Classic checks include thirty millimetres of subject at four millimetres of DOF with twenty-five percent overlap for a dense macro stack, a shallow product where subject depth is smaller than DOF so frame_count is one, and a deliberate non-positive depth or illegal overlap as the mandatory invalid_input path.
Practical stacking tips and related searches
Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately set depth to zero or overlap to one. Round-trip checks are easy: recompute step equals DOF times one minus overlap by hand and confirm frame_count matches the ceiling formula within the same fixed rounding used for published fields.
Technical questions
What inputs does the focus stacking frame count calculator need?
Three numbers: subject_depth and dof_per_shot in the same length unit, and overlap as a fraction in [0, 1). It returns frame_count, step_size, focus_steps, and total_covered.