ForHosting KIT · Developer Utilities

Thin lens image distance calculator

The thin lens image distance calculator solves the Gaussian thin lens equation when you know the lens focal length and the object's signed distance from the lens.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

It returns the signed image distance and labels the result as a real or virtual image, making the sign meaningful instead of presenting an unexplained number. Use any consistent length unit—millimeters, centimeters, meters, or inches—because the equation depends on ratios. The calculation is deterministic, runs without network access, and is available for individual checks or repeatable API workflows.

Enter distances with a consistent sign convention

A thin-lens calculation is only as clear as its sign convention. This calculator uses the Gaussian convention represented by 1/f = 1/do + 1/di. Enter a positive focal length for a converging lens and a negative focal length for a diverging lens. A normal real object placed in front of the lens has a positive object distance. Both inputs must use the same physical unit, but you do not need to tell the calculator which unit it is. If focal length is entered in millimeters, image distance is returned in millimeters; if both inputs are in centimeters, the answer is in centimeters. Do not mix a focal length in millimeters with an object distance in centimeters unless you convert one first. The result is signed: a positive image distance describes a real image on the image side of the lens, while a negative image distance describes a virtual image on the object side. This convention lets one equation cover converging lenses, diverging lenses, real objects, and virtual-object setups without silently discarding the physical meaning of direction.

Understand the equation and the singular case

Starting from the thin lens equation, 1/f = 1/do + 1/di, isolate the unknown reciprocal to obtain 1/di = 1/f - 1/do. Combining the fractions and inverting gives di = f·do/(do-f). The calculator evaluates that expression with finite-number validation and rounds only the returned fields to the requested precision. One configuration needs special attention: when object distance equals focal length, the denominator do-f is zero. Geometrically, rays leaving the lens are parallel, so the image is described as being at infinity rather than at a finite location. Because infinity is not a usable JSON distance, the calculator reports that configuration as an input error instead of returning a misleading enormous number or a null field. Inputs of zero are also rejected because the reciprocal form of the thin lens equation would be undefined. Values extremely close to the focal plane can produce very large finite answers, matching the strong sensitivity expected near focus; ensure your measurements have enough precision before interpreting such a result as an exact placement distance.

Interpret the result in optical work

The returned image_distance is the primary answer. A positive value is labeled real and inverted, which is the common case when a real object sits beyond the focal point of a converging lens. A screen or sensor can be placed approximately that signed distance from the lens to intercept the focused image, subject to the limits of the thin-lens approximation. A negative value is labeled virtual and upright. Such an image cannot be projected directly onto a screen at that location; an observer sees it by tracing the emerging rays backward. This occurs for a converging lens when the object lies inside its focal length and for many ordinary uses of a diverging lens. Real lenses have thickness, principal planes, aberrations, wavelength dependence, and mounting tolerances that the ideal equation does not model. Measure distances from the appropriate principal plane when precision matters, and regard the result as a first-order design value. For repeated calculations, the API costs $0.002 per request and returns the formula, normalized inputs, classification, and chosen precision alongside the distance so downstream records remain understandable.

Place a camera sensor

Estimate the sensor-to-lens distance required to focus an object at a known distance with an ideal thin lens.

Check a classroom optics problem

Solve image distance and confirm whether the expected image is real and inverted or virtual and upright.

Screen an optical design

Evaluate many focal-length and object-distance combinations before moving to a detailed ray-tracing model.

Which equation does the calculator use?

It uses 1/f = 1/do + 1/di and solves it as di = f·do/(do-f).

What units should I use?

Use any length unit, but use the same unit for focal length and object distance. The image distance is returned in that unit.

Why is my image distance negative?

A negative image distance indicates a virtual, upright image under the stated Gaussian sign convention.

What happens when object distance equals focal length?

The ideal image is at infinity, so the calculator returns an input error rather than a finite distance.

How much does the API request cost?

Each API calculation costs $0.002. The computation is deterministic and requires no external service.

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/optics/image-distance-thin-lens

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/optics/image-distance-thin-lens \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"focal_length":10,"object_distance":30}'
{
  "focal_length": 10,
  "object_distance": 30
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "optics.image_distance_thin_lens",
  "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.

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 full KIT documentation →