ForHosting KIT · Unit converters

Diopter converter

2 diopters means a focal length of 500 mm, half a metre. Convert optical power to focal length in m, cm, mm or inches and back, with negative values marked as diverging lenses, for prescriptions, loupes and optics homework. 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
Value
2
From
D
To
Mm
You get
Result
500 mm
Converted
500
Diopters
2
Focal length m
0.5

A diopter converter turns optical power in diopters into the equivalent thin-lens focal length—or the reverse—without juggling reciprocal metres and unit-scale mistakes. Enter a finite non-zero value plus a source unit and a target unit among diopters (D), metres, centimetres, millimetres, and inches; the tool returns the converted magnitude, the intermediate power in diopters, the focal length in metres, the lens type from the sign of power, and step-by-step substitution lines you can paste into a lab notebook, eyeglass worksheet, or optics homework check. Opticians mapping prescription diopters to focal length in millimetres, students checking P equals one over f, and engineers specifying reading lenses or loupes in inches all need the same deterministic path.

Which units are supported and how diopter conversion works

This capability converts among five units that dominate classroom optics, optometry worksheets, and product specs for lenses and loupes. Diopters are optical power in reciprocal metres: one diopter means a one-metre focal length under the thin-lens sign convention used here. Metres, centimetres, millimetres, and inches are treated as focal-length magnitudes of that same equivalent focus.

The internal hub is always diopters: every length is first scaled to metres with exact factors, then inverted to power, and every outgoing length is obtained by inverting power back to metres and dividing by the target scale. Millimetres use one thousandth of a metre; centimetres use one hundredth; inches use the exact international definition zero point zero two five four metres per inch—no survey-foot ambiguity. Same-unit requests succeed and return the input magnitude with a short message that no change of unit was required.

Negative values are allowed for diverging or negative lenses; zero is rejected because the reciprocal is undefined.

Practical tips, limits, and when to use this landing

Prefer sending bare numbers for value when you control the client; string numbers are accepted only when they match a strict finite numeric pattern without unit symbols glued to the digits—put the unit in the from field instead. Classic checks include two diopters to five hundred millimetres, four diopters to two hundred fifty millimetres, negative two diopters to negative five hundred millimetres for a diverging lens, and five hundred millimetres back to two diopters.

Inch paths use the exact zero point zero two five four metre factor so round-trips stay stable under twelve-decimal rounding. Stay inside the absolute range so intermediate reciprocal values cannot overflow. This landing targets people searching for a diopter converter, diopters to mm, diopters to inches, focal length to diopters, or optical power unit conversion online; it is not a lensmaker calculator, not a full prescription sphere-cylinder-axis tool, and not a general length converter without the optical-power hub.

Eyeglass and contact-lens worksheets

Convert prescription diopters to equivalent focal length in millimetres or inches for teaching charts, lab benches, and patient-education printouts.

Loupe and reading-lens product specs

Catalog tools map diopter ratings on magnifiers to focal length in inches for retail copy and mixed-unit engineering drawings.

Is the diopter converter free?

The browser tool is free and runs locally.

Can I convert a focal length back to diopters?

Yes. Enter the focal length in metres, centimetres, millimetres or inches and choose diopters as the target. Inches use the exact factor of 0.0254 metres, so round trips stay stable.

What does a negative diopter value mean?

It describes a diverging lens. The sign carries through, so −2 diopters becomes −500 mm, and the result tells you whether the lens is converging or diverging.

Why can't I convert 0 diopters?

Because power and focal length are reciprocals, and one divided by zero has no value. A lens with zero power has no focal length to report, so the value is rejected.

Can it read a full eyeglass prescription?

No. It converts one power or one focal length between units. Sphere, cylinder and axis values from a prescription, or a lensmaker calculation, need a different tool.

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/conv/diopter

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/conv/diopter \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":2,"from":"D","to":"mm"}'
{
  "value": 2,
  "from": "D",
  "to": "mm"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "conv.diopter",
  "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.

Unknown unit names fail with a clear invalid_input error instead of inventing silent wrong factors.

Which units are supported and how diopter conversion works

Common aliases are accepted case-insensitively: diopter, dioptre, dpt, and optical power for D; meter, metre, and metres for m; millimeter and millimetre for mm; inch and inches for in. If the name is not on that list the solver rejects the request with invalid_input naming the bad field and listing supported units, so clients never guess whether a typo produced a wrong number. Absolute magnitude must stay within the published one-trillion limit so intermediate products remain finite in IEEE double precision on the Worker and in the browser.

How to call the API and read the response

Value must be a finite non-zero number or a strict numeric string within absolute limits of one trillion. Wire this into dashboards, optometry helpers, product configurators, or batch jobs that already hold a diopter reading and only need millimetres or inches for display, standards compliance, or mixed-unit comparison without shipping reciprocal conversion tables in every app binary. Send a JSON body with three required fields: value (aliases amount, n, power, and focal), from (aliases from_unit, unit_from, and source), and to (aliases to_unit, unit_to, and target). From and to must resolve to supported unit names after alias normalization; the public enum lists the five canonical tokens D, m, cm, mm, and in. On success the response echoes the rounded input value, canonical from and to labels, result and converted set to the same rounded target magnitude, diopters as the hub power, focal_length_m as the equivalent focus in metres, unit as the target label, lens_type as converging or diverging from the sign of power, formula as the short equation string, message as an English summary, steps as ordered substitution lines, and supported_units as the five canonical identifiers. Failed validation—missing fields, non-finite numbers, zero value, values outside absolute limits, or an unknown unit name—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item.

Practical tips, limits, and when to use this landing

Prefer this capability when both endpoints are among the five supported units and you need deterministic factors and step strings; if you only need power from focal length in metres with a physics-oriented response shape, the dedicated lens power calculator may fit that narrower query. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when clients deliberately probe unknown unit names or zero magnitudes.

Optics homework and exam checks

Students verify P = 1/f across D, m, cm, and mm with deterministic step strings that match textbook reciprocal-metre conventions.

Which units can I convert with the diopter converter?

Diopters (D), and focal length in metres (m), centimetres (cm), millimetres (mm), and inches (in), including common aliases such as dioptre, millimeter, and inch.

What happens if I send an unknown unit name?

The API returns invalid_input, names the bad field, and lists the supported units. The failed task is not charged.

How many millimetres is 2 diopters?

Exactly 500 mm under the thin-lens relation P (D) = 1/f (m): f = 0.5 m = 500 mm. This tool uses that exact reciprocal with fixed twelve-decimal rounding.

Are results deterministic across browser and API?

Yes. Handler and widget share the same lib.js solve path with exact metre factors and twelve-decimal rounding, so golden examples match production.

Read the full KIT documentation →