ForHosting KIT · Science

Lens power calculator

Switch between focal length and diopters in one step: a focal length of 0.5 m is a power of 2 diopters, a converging lens, and the same reciprocal works in reverse. 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
Focal length m
0.5
You get
Power d
2
Diopters
2
Direction
focal_to_power
Source
focal_length_m

A lens power calculator turns a thin-lens focal length in metres into optical power in diopters, and converts diopters back into focal length with the same closed formula. Students, optician trainees, and instrument builders all need that reciprocal without a full optics lab notebook.

What optical power means for a thin lens

In geometric optics the optical power, also called dioptric power, of a thin lens in air is defined by the reciprocal of the focal length when the focal length is expressed in metres. If f is the signed focal length in metres, the power P in diopters equals one over f, and the SI unit of a diopter is inverse metres.

A positive power means a converging lens that brings parallel rays to a real focus on the far side; a negative power means a diverging lens that spreads parallel rays as if they came from a virtual focus on the near side. The sign convention used here matches classroom thin-lens practice: positive f for converging elements and negative f for diverging elements, so P inherits the same sign.

That single reciprocal is enough for many homework and lab checks even though real thick lenses, contact lenses, and spectacle designs also involve surface powers, refractive index, and vertex distance. The check path recomputes one over f with the same fixed rounding used for published fields, so a successful response always ships with steps you can assert in tests or worksheets.

Practical tips, limits, and related searches

Always convert millimetres or centimetres to metres before calling: a fifty-millimetre camera lens is zero point zero five metres and therefore twenty diopters, not fifty. Keep magnitudes inside the published absolute range so one over f cannot overflow into a non-finite power that the solver must reject. Prefer sending numbers rather than pre-formatted strings when you control the client; string numbers are accepted only when they match a strict finite numeric pattern.

Prefer this capability when you already have f or P in SI units and only need the reciprocal pair; if your source is a word problem in millimetres, convert first.

Instrument and camera pre-flight

Pipelines convert a measured or catalog focal length into diopters (or the reverse) before storing optical power alongside other SI metadata.

What is optical power in diopters?

For a thin lens in air, optical power P in diopters equals one over the focal length f when f is in metres. One diopter is one inverse metre (m⁻¹).

Does this use the lensmaker’s formula?

Surface radii and refractive index are out of scope.

Is the lens power calculator free?

The browser tool is free and runs locally.

How many diopters is a focal length of 0.5 m?

Two diopters. Power is one over the focal length in metres, so 0.5 m gives 2 diopters, and the positive sign marks a converging lens.

What does a negative lens power mean?

It means a diverging lens. Parallel rays spread out as if they came from a virtual focus on the near side, and the focal length carries the same negative sign as the power.

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/lens-power

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/lens-power \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"focal_length_m":0.5}'
{
  "focal_length_m": 0.5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "optics.lens_power",
  "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.

max_abs1000000000000
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.

Enter focal_length_m for a converging or diverging lens and receive power_d equal to one over f, a clear lens-type label from the sign of the power, substitution steps, and mirrored diopters field for callers that prefer the unit name. Enter power_d alone when you already know the prescription-style strength and need the equivalent focal length in metres. Zero focal length is rejected with invalid_input because optical power is undefined when f is zero; zero power is likewise rejected on the inverse path because f would be infinite.

What optical power means for a thin lens

Teachers care about the zero-f rejection as much as the arithmetic: a student who reports infinite diopters has left the domain of this tool, and a silent Infinity in JSON would hide that mistake.

How to call the API and what comes back

When both fields are present, focal length is the source of truth if it is non-zero and power is recomputed from it so the pair stays consistent. Send a JSON body with at least one of two finite numbers: focal_length_m in metres (aliases f, focal_length, focal_m, focal) or power_d in diopters (aliases diopters, power, P, optical_power, D). Absolute values must stay within the published limit of one trillion so the reciprocal remains finite in IEEE double precision on the Worker and in the browser. When only focal length is given, the solver rejects zero or near-zero f, sets power_d to one over f, and marks direction as focal_to_power. When only power is given, it rejects zero or near-zero P, sets focal_length_m to one over P, and marks direction as power_to_focal. On success the response echoes rounded focal_length_m and power_d, mirrors power as diopters, sets formula to the string P left-paren D right-paren equals one over f left-paren m right-paren, lens_type to converging or diverging, units to m and D, message to a short English summary, and steps to an ordered array of substitution lines. Failed validation—missing both fields, non-finite numbers, values outside absolute limits, or a zero reciprocal—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.

Practical tips, limits, and related searches

When teaching, pair examples: half a metre focal length yields two diopters and a converging label; negative one quarter metre yields negative four diopters and diverging; two diopters alone recovers zero point five metres; and focal length zero demonstrates the hard invalid_input path. This landing targets people searching for a lens power calculator, diopters from focal length, or optical power P equals one over f online; it is not a lensmaker’s formula tool that needs radii and refractive index, not a thick-lens vertex-power calculator, and not a full ray tracer. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately send zero. Round-trip checks are easy: recompute one over the published focal length by hand and confirm it equals power_d within the same twelve-decimal rounding, then invert again and confirm focal length returns.

Homework checks for P = 1/f

Students enter focal length in metres from textbook thin-lens problems and compare hand-written diopters, sign, and lens type against a deterministic result before submitting.

Unit tests for optics libraries

Generate known-good positive and negative power cases plus deliberate zero-focal-length rejections for coding kata expected values and CI fixtures.

What happens when focal length is zero?

P = 1/f is undefined. This tool returns invalid_input instead of Infinity or a silent NaN.

Can focal length or power be negative?

Yes. Negative values describe diverging (negative) lenses under the usual thin-lens sign convention; the response labels lens_type as diverging.

Read the full KIT documentation →