ForHosting KIT · Science

Lensmaker's equation

Get the focal length of a thin lens from its material, the medium around it and its two curved faces: a lens of index 1.5 in air with radii of 0.1 and -0.1 m focuses at 0.1 m. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N lens
1.5
N medium
1
R1
0.1
R2
-0.1
You get
Focal length
0.1

The lensmaker's equation gives the focal length of a thin lens from the refractive index of the lens material, the refractive index of the surrounding medium, and the two surface radii of curvature. Use it for homework checks, laboratory design, and any pipeline that needs a transparent thin-lens focal length without opening a ray tracer.

What the lensmaker's equation tells you

A thin lens bends light at its two curved faces, and each face adds some optical power. The lensmaker's equation adds them up: one over the focal length equals the lens index divided by the medium index, minus one, times one over the first radius minus one over the second radius. The focal length is the reciprocal of that power, and it comes out in the same length unit you used for the radii, so radii in metres give a result in metres. It is the first-order model taught in introductory optics, handy for checking homework, planning a lab setup or sizing a camera lens, a magnifier or an immersion objective early on.

Mistakes that give the wrong focal length

The most common one is the sign of the radii. With light travelling left to right, a radius is positive when its centre of curvature lies to the right of the surface, so a biconvex lens has a negative second radius. The second is forgetting the medium: the same glass focuses more weakly in water or oil than in air. A radius of exactly zero cannot be used, because the equation divides by it. Finally, the model assumes a lens that is thin compared with its radii and has spherical faces; thick lenses, aspheres and multi-element objectives need more detailed modelling.

Singlet power in air or in a fluid

Estimate converging or diverging power for a glass or plastic singlet in air, water, or oil during early camera, magnifier, or immersion-objective sizing.

Why is a surface radius of zero rejected?

Send a finite non-zero radius using the Cartesian sign convention.

Does this handle thick lenses or multi-element systems?

No. This capability returns the standard thin-lens closed form only. Thick lenses need centre thickness and a fuller formula; multi-element systems need ray tracing or manufacturer prescriptions.

Which sign should each lens radius have?

Use the Cartesian convention with light travelling left to right: a radius is positive when its centre of curvature lies to the right of the surface. That is why a typical biconvex lens has a positive first radius and a negative second one.

What refractive index should I enter for glass, acrylic or water?

Crown glass is about 1.52 and acrylic about 1.49. For the surrounding medium, air and vacuum are 1 and water is about 1.333. The lens index must be different from the medium index.

Why is a lens weaker in water than in air?

Because the equation uses the ratio of the lens index to the medium index. Water, at about 1.333, is closer to glass than air is, so the ratio shrinks, the power drops and the focal length gets longer.

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/phys/lensmakers-equation

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/phys/lensmakers-equation \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n_lens":1.5,"n_medium":1,"r1":0.1,"r2":-0.1}'
{
  "n_lens": 1.5,
  "n_medium": 1,
  "r1": 0.1,
  "r2": -0.1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "phys.lensmakers_equation",
  "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.

When the same singlet sits in water, oil, or any other medium, that one is replaced by the ratio of the two indices: one over f equals n_lens over n_medium minus one, times the same curvature difference. This capability evaluates that closed form and returns the focal length in the same length unit as the radii. A surface radius of exactly zero would divide by zero and is rejected as invalid_input.

What the lensmaker equation assumes and when it applies

The focal length is the reciprocal of that power. Radii follow the Cartesian sign convention with light traveling left to right: a radius is positive when the centre of curvature lies to the right of the surface. Real thick lenses need the extra centre-thickness term; aspheres, gradient-index glass, and multi-element objectives need ray tracing. This tool returns only the ideal thin-lens focal length so you can check textbook problems, seed a design, or document a baseline before detailed modeling. The thin-lens lensmaker equation is the first-order model taught in introductory optics: the lens thickness is negligible compared with the radii and with the object and image distances, both faces are spherical, and the surrounding medium is homogeneous with refractive index n_medium. Under those assumptions the optical power of the two surfaces adds, and the combined power in the surrounding medium is n_lens over n_medium minus one, times the difference of the surface curvatures. In water n_medium is about 1.333, so a glass singlet that is strong in air becomes much weaker because the index contrast shrinks. A surface radius of zero is not accepted as a planar face here: the formula would divide by zero, so the capability fails with invalid_input instead of inventing an infinite radius.

Input contract, response shape, and error behaviour

Both refractive indices must be strictly positive. Convert millimetres to metres before calling if your drawings use millimetres; mixing units produces a well-formed number that is wrong for the geometry you intended. Each field may arrive as a JSON number or as a numeric string. Missing fields, empty strings, and non-finite values fail with invalid_input naming the field, and those failures are not billed. Equal indices n_lens equals n_medium produce zero optical power and an undefined focal length, so that case is also invalid_input. On success the body echoes the four inputs, reports focal_length in the same length unit as the radii, and includes a formula string for audit logs. Pricing for a successful analytic call is a flat $0.002 per item.

Where a thin-lens focal length API earns its keep

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, especially when the singlet will sit behind a window or in a fluid rather than in air. 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. Failed validation does not consume balance. Keep classroom centimetre radii inside ordinary SI magnitudes, pin the rounded focal length in tests, and you get reproducible first-order optics for homework, LMS plugins, and edge workers without standing up a ray tracer of your own. Physics and engineering courses use the calculator to verify homework and lab prep: students pick crown glass near n_lens 1.5, choose a surrounding medium of air or water, pick symmetric biconvex radii, and confirm that f matches the expected value before grinding or measuring on an optical bench. Underwater imaging, oil-immersion microscope objectives, and index-matching baths are the cases where n_medium is not one and the air-only formula would lie; sending the true surrounding index is the whole point of this landing. 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 with an explicit surrounding medium, 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.

Homework and lab expected focal length

Compute the ideal thin-lens f from n_lens, n_medium, 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.

What formula does the lensmaker's equation calculator use?

The generalized thin-lens form 1/f = (n_lens/n_medium − 1)(1/R1 − 1/R2). When n_medium is one this is the familiar air formula. The response reports focal_length in the same length unit as the radii.

What sign convention do R1 and R2 use?

Cartesian convention with light left to right: a radius is positive when the centre 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.

Read the full KIT documentation →