Thin lens calculator 1/f

Enter the object and image distances. The calculator folds them into the thin-lens equation: 1/f = 1/x + 1/y. When both distances are 0.5 m, the focal length is 0.25 m, or 4 diopters. The same x and y on the magnification page give p = 1.

Magnification from the same x and y: p = y/x. A different f, waves: λ = v/f. Photon: E = h·f.

Inputs

Result

Object distance x (m) and Image distance y (m). The result shows up here.

How it works

x y 1/f = 1/x + 1/y
Thin lens: from x and y you get focal length f.

A thin lens bends rays as if all the work happened in one plane. In the school “real is positive” convention, object distance x and image distance y go into one equation: 1/f = 1/x + 1/y, so f = xy/(x+y). f is the harmonic mean of x and y, not the arithmetic mean. Two 0.5 m stretches give 1/f = 4 m⁻¹, so f = 0.25 m, not 0.5 m.

Worth doing on paper before you click. x = 0.5 m, y = 0.5 m: 1/0.5 + 1/0.5 = 4, f = 0.25 m. A diopter is 1/f with f in meters, so 4 D. That glass is a strong magnifier or a short camera lens. Second frame: subject two meters out, image 52 mm behind the lens. 1/2 + 1/0.052 ≈ 19.73 m⁻¹, f ≈ 0.0507 m. The 50 mm mark on a lens barrel lives in that same range.

Type both distances in meters (or feet if the header is on US). f comes back in the same unit. Beside it sits 1/f in diopters: opticians write lens strength that way; school work often stays in centimeters. A comma and a period are the same, so 0.5 can be 0,5.

x and y have to be positive. Zero means the object or the image sits in the lens plane, and the formula has no finite f. A negative y (virtual image, same side as the object) belongs on paper in another sign convention; this field wants a real image. A diverging lens would have negative f. Here positive x and y give positive f: converging, image on the far side.

The form needs two fields. The calculator example 0.5 and 0.5 gives 0.25 m. The pair 0.3 m and 0.6 m gives f = 0.2 m, because 1/0.3 + 1/0.6 = 5. The chart of f versus y at fixed x is a hyperbola: the farther the image, the closer f sits to x.

Feed the same x and y into the magnification page to get p = y/x. Here you want focal length, there image scale. A telescope or microscope stacks two lenses and uses other formulas. A thick lens measures distances from principal planes, not from the middle of the glass.

How to use

  1. Measure the object-to-lens distance and type it as x. In a school problem x is often in centimeters: 50 cm is 0.5 m.
  2. Measure or read the image distance y, also positive when the image is real and on the far side of the glass.
  3. Compute. The pair 0.5 m and 0.5 m gives f = 0.25 m. Beside the result sits 4 D, because a diopter is 1/f with f in meters.
  4. Check a second frame if you are sizing a camera lens: x = 2 m and y = 0.052 m should land near 50.7 mm, close to a 50 mm label.
  5. Open the same x and y on the magnification page. There p = y/x; here you stay with focal length.

Formula

1/f = 1/x + 1/y

f = xy / (x + y). x > 0, y > 0. Unit of f: meter (or ft in US).

Letters in 1/f = 1/x + 1/y

A thin lens adds reciprocals: 1/f = 1/x + 1/y. Two 0.5 m distances give f = 0.25 m, or 4 diopters, not the 0.5 m average.

f
Focal length in meters. f = xy/(x+y); at x = y = 0.5 m you get 0.25 m, a harmonic mean, not an arithmetic one.
x
Object distance in meters. Together with y = 0.5 m it sets 1/f = 4 m⁻¹.
y
Image distance in meters. The same 0.5 m on the image side closes the pair that would give p = 1 on the magnification card.

Real-life examples

Example 1

x = 0.5 m, y = 0.5 m -> f = 0.25 m.

Example 2

x = 0.3 m, y = 0.6 m -> f = 0.2 m.

Example 3

x = 2 m, y = 0.052 m -> f ≈ 0.0507 m.

Example 4

x = 0.25 m, y = 0.25 m -> f = 0.125 m.

Example 5

x = 1 m, y = 0.25 m -> f = 0.2 m.

Example 6

x = 0.1 m, y = 2 m -> f ≈ 0.0952 m.

Example 7

x = 0.2 m, y = 0.3 m -> f = 0.12 m.

Example 8

x = 2 m, y = 0.1 m -> f ≈ 0.0952 m.

Ways to use this calculator

  • You check that f = 0.25 m and 4 D come from x = y = 0.5 m.
  • You drop in a 2 m / 52 mm frame and compare with the 50 mm mark on a lens.
  • You take the same x and y to p = y/x to get the image scale.

Frequently asked questions

What f at x = 0.5 m and y = 0.5 m?

1/f = 2 + 2 = 4, so f = 0.25 m and 4 diopters. The pair 1 m and 1 m gives f = 0.5 m, or +2 D like reading glasses.

Why is f smaller than x and y at 0.5 m each?

Because 1/f is a sum of reciprocals. Two 0.5 m distances make 4 m⁻¹. f is not the arithmetic midpoint of x and y.

Where do 4 diopters come from at f = 0.25 m?

D = 1/f with f in meters. 0.25 m is 4 D. +2 D glasses are f = 0.5 m. The field solves f; diopters sit beside it.

Which units do I type?

x and y in meters, or feet if the header is on US. Both fields on the same scale. Result f in those same units.

What if x or y is zero?

The formula has no finite f: you would divide by zero. An object or image in the lens plane does not give a focal length in this model.

Where is a virtual image (negative y)?

Here y is positive: a real image. Negative y belongs on paper in the sign convention from the problem, not in this field.

How does this relate to magnification p = y/x?

Same x and y. Here you want f. There the ratio y/x. At 0.3 m and 0.6 m you have f = 0.2 m and p = 2.

Is this a telescope or a microscope?

One thin lens. A telescope or microscope stacks an objective with an eyepiece and uses other formulas.

What f at x = 2 m and y = 52 mm?

y = 0.052 m. 1/f = 0.5 + 19.23 ≈ 19.73, f ≈ 0.0507 m, about 50.7 mm.

Does the light have to be yellow?

The formula does not know color. In glass, f shifts a little with λ (dispersion). Here one f, as in a problem without a prism.

Knowledge sources

The formula is the school one. Units follow SI; NIST SP 330 and BIPM define the measures, not your result.

Page updated in 2026.