Home › Physics › Thin Lens Equation Calculator
Thin Lens Equation Calculator
Solves the thin-lens / mirror equation 1/f = 1/d_o + 1/d_i for the image distance of a converging or diverging lens, or a concave or convex mirror, and reports the magnification, image height and whether the image is real or virtual, inverted or upright, enlarged or reduced.
When to use
You know the focal length of a lens or curved mirror and the object distance and need where the image forms, how large it is and its character (real/virtual, upright/inverted).
Do not use when: The lens is thick or part of a multi-element system, you need the focal length from surface curvatures (lensmaker's equation), or you need refraction angles at a flat surface (use snells-law).
Formula
1 / f = 1 / object_distance_cm + 1 / image_distance_cm with f = +focal_length_cm (converging lens, concave mirror) or −focal_length_cm (diverging lens, convex mirror); magnification = −image_distance_cm / object_distance_cm; image_height_cm = magnification × object_height_cm
Gaussian thin-lens and mirror equations in the real-is-positive convention (paraxial rays, negligible lens thickness): for lenses a positive image distance lies on the far side of the lens, for mirrors in front of the mirror; an object exactly at the focal point gives an image at infinity and is rejected.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
optic | enum: converging_lens | diverging_lens | concave_mirror | convex_mirror | yes | Type of optic; it sets the sign of the focal length (converging lens and concave mirror positive, diverging lens and convex mirror negative). | |
focal_length_cm | number | cm | yes | Magnitude of the focal length in centimetres, always positive; the sign is applied from optic. For a spherical mirror f = R / 2. Range: > 0 |
object_distance_cm | number | cm | yes | Distance from the object to the lens or mirror in centimetres (a real object, always positive). Range: > 0 |
object_height_cm | number | cm | default 1 | Height of the object in centimetres (default 1, so image_height_cm equals the magnification). Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
focal_length_signed_cm | number | cm | Focal length with the sign convention applied: positive for converging lens and concave mirror, negative for diverging lens and convex mirror. |
image_distance_cm | number | cm | d_i = 1 / (1/f − 1/d_o), signed: positive = real image, negative = virtual image (see image_location_note). |
magnification | number | m = −d_i / d_o; negative means inverted, |m| > 1 enlarged. | |
image_height_cm | number | cm | m × object_height_cm, signed (negative = inverted). |
image_type | string | real (light actually converges there, can be projected on a screen) or virtual (appears to come from that point). | |
orientation | string | inverted (m < 0) or upright (m > 0) relative to the object. | |
size | string | enlarged (|m| > 1), reduced (|m| < 1) or same size (|m| = 1). | |
image_location_note | string | Where the image lies and what the sign of image_distance_cm means for this optic. |
Example
Converging lens f = 10 cm, object at 15 cm: {"optic":"converging_lens","focal_length_cm":10,"object_distance_cm":15} → {"focal_length_signed_cm":10,"image_distance_cm":30,"magnification":-2,"image_height_cm":-2,"image_type":"real","orientation":"inverted","size":"enlarged"}
Convex mirror f = 10 cm, object at 20 cm: {"optic":"convex_mirror","focal_length_cm":10,"object_distance_cm":20} → {"focal_length_signed_cm":-10,"image_distance_cm":-6.6667,"magnification":0.3333,"image_height_cm":0.3333,"image_type":"virtual","orientation":"upright","size":"reduced"}
GET https://tttkmbb.com/api/v1/calculate/lens-equation?optic=converging_lens&focal_length_cm=10&object_distance_cm=15
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/lens-equation(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/lens-equation · Markdown: https://tttkmbb.com/physics/lens-equation.md · JSON definition: https://tttkmbb.com/physics/lens-equation.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="lens-equation" - OpenAPI operationId:
solve_thin_lens_equation - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Thin lens (thin lens equation) (reference)
- Wikipedia – Curved mirror (mirror equation) (reference)
- HyperPhysics – Thin lens equation (reference)
FAQ
What happens when the object is inside the focal length of a converging lens?
The image becomes virtual, upright and enlarged, as in a magnifying glass: f = 10 cm and d_o = 5 cm give d_i = −10 cm and m = +2.
How do I get the focal length of a mirror?
For a spherical mirror f = R / 2, half the radius of curvature; enter the magnitude and pick concave_mirror or convex_mirror to set the sign.
Why is the image distance negative?
A negative d_i is a virtual image: for a lens it lies on the same side as the object (seen by looking through the lens), for a mirror behind the mirror surface. Diverging lenses and convex mirrors always give virtual, upright, reduced images of real objects.
Related calculators
- Snell's Law Calculator — Refraction at a single flat surface, the basis of lens action.
- Wavelength & Frequency Calculator — Wavelength and frequency of the light used.