Lensmaker's equation
Check a textbook lens in seconds: crown glass near index 1.5 with symmetric radii of 0.1 m and -0.1 m focuses at 0.1 m, a converging lens of 10 diopters, under the thin-lens model taught in class. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 1.5
- R1
- 0.1
- R2
- -0.1
- R1 m
- 0.1
- R2 m
- -0.1
- Optical power dpt
- 10
- Focal length m
- 0.1
The lensmaker's equation links a thin lens's focal length to the refractive index of its material and the two surface radii of curvature. Use it for optics homework, lab design, camera and microscope rough sizing, and any pipeline that needs a transparent thin-lens focal length without spreadsheets or opaque calculators. Index equal to one is rejected because the lens would match the surrounding medium and produce no optical power.
What the lensmaker equation assumes and when it applies
The thin-lens lensmaker equation is the standard first-order model taught in introductory optics: the lens thickness is negligible compared with the radii and the object and image distances, surfaces are spherical (or planar), and the surrounding medium is air with refractive index essentially one. Under those assumptions the optical power of the two surfaces adds, and the combined power is (n minus one) times the difference of the surface curvatures.
Real thick lenses need the full thick-lens formula with center thickness and refractive indices of object and image spaces; aspheric elements, gradient-index glass, and multi-element objectives need ray-tracing or manufacturer data. This tool deliberately returns the ideal thin-lens result so you can check textbook problems, seed a design before detailed modeling, or document a baseline power. Radii use the Cartesian sign convention with light traveling left to right: a radius is positive when the center of curvature lies to the right of the surface.
Planar faces are accepted as radius zero, which contributes zero curvature and matches the usual student-calculator convention for plano-convex and plano-concave elements.
Where teams use thin-lens focal length in practice
Physics and engineering courses use the calculator to verify homework and lab prep: students pick crown glass near n equals 1.5, choose symmetric biconvex radii, and confirm that f matches the expected value before grinding or measuring on an optical bench. Product teams sizing simple magnifiers, LED collimators, or phone-camera singlet concepts need a transparent power estimate before they open a full optical design package.
Instrumentation groups compare measured focal lengths against the thin-lens prediction to flag wrong glass type, inverted surface order, or a setup that is no longer thin.
What you can do with it
Quick singlet power for product concepts
Estimate converging or diverging power for a glass or plastic singlet during early camera, magnifier, or collimator sizing before detailed design.
FAQ
Why is refractive index equal to one rejected?
If n equals one, the lens matches the surrounding medium and the formula gives zero optical power for any radii.
Does this handle thick lenses or multi-element systems?
No. This capability returns the standard thin-lens closed form only. Thick lenses need center thickness and a fuller formula; multi-element systems need ray tracing or manufacturer prescriptions.
What does the lensmaker's equation say?
The power of a thin lens equals the material index minus one, times the difference between the curvatures of its two faces. The focal length is the reciprocal of that power.
Why does my measured focal length differ from the prediction?
Common causes are the wrong glass type, the surfaces entered in the reverse order, or a lens that is too thick for the thin-lens model. Comparing both values is a quick way to spot these issues.
What refractive index should I use for ordinary glass?
Crown glass is close to 1.5, the value most textbook exercises use. For other materials, take the index from the glass or plastic data you are working with.
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/optics/lensmaker \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":1.5,"r1":0.1,"r2":-0.1}'const res = await fetch("https://api.kit.forhosting.com/optics/lensmaker", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 1.5,
"r1": 0.1,
"r2": -0.1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/optics/lensmaker",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 1.5,
"r1": 0.1,
"r2": -0.1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/optics/lensmaker", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":1.5,"r1":0.1,"r2":-0.1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":1.5,"r1":0.1,"r2":-0.1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/optics/lensmaker", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 1.5,
"r1": 0.1,
"r2": -0.1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "optics.lensmaker",
"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
Inputs, outputs, units, and validation rules
All three must be finite. Either radius may be zero to mean a flat surface; non-zero radii may be positive or negative according to the sign convention. Convert millimeters to meters before calling if your drawings use mm; convert diopters to focal length with f equals one over P when you only know power. The index must be strictly positive and must not equal one—when n equals one the formula predicts zero power for any radii, which is unphysical for a focusing element and is rejected with invalid_input so clients fail fast. The response echoes n, r1_m, and r2_m, then optical_power_dpt (diopters when lengths are in meters), focal_length_m (meters, or null when power is exactly zero for an afocal combination), lens_type (converging, diverging, or afocal), and the formula string for audit logs. Missing fields, non-numeric strings, non-positive index, or index exactly one fail with invalid_input and are not charged. Pricing for a successful analytic call is a flat $0.002 per item.
Where teams use thin-lens focal length in practice
Because each successful call is a single analytic item at $0.002, scripts can sweep families of radii or index tables without a subscription or model cost. Prefer this endpoint when you want a stable, reviewable closed form—not a thick-lens solver, not multi-element ray tracing, and not wavelength-dependent dispersion, which require additional thickness, spacing, and glass catalog inputs beyond this contract.
Integration use cases
Homework and lab expected focal length
Compute the ideal thin-lens f from n, R1, and R2 before students measure focal length on an optical bench and report percent error.
Parameter sweeps in design scripts
Batch-call the API across radius pairs and index tables to build focal-length charts without spreadsheets or opaque desktop calculators.
Technical questions
What formula does the lensmaker's equation calculator use?
It uses the thin-lens form in air: 1/f = (n − 1)(1/R1 − 1/R2). Outputs include focal length in meters, optical power in diopters, and a converging/diverging/afocal label.
What sign convention do R1 and R2 use?
Cartesian convention with light left to right: a radius is positive when the center of curvature is to the right of the surface. A typical biconvex lens has R1 > 0 and R2 < 0.
How much does each API call cost?
$0.002 per successful request. The browser tool above runs free locally; the API draws from your prepaid KIT balance only when the task succeeds.