Lens Equation Calculator

Solve the thin lens equation for f, do or di — plus magnification, optical power and a live ray diagram.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

The lens equation calculator solves the fundamental thin-lens relationship for any unknown — focal length, object distance, or image distance — in a single step, then extends the result to magnification, optical power in diopters, image classification, and a schematic ray diagram. A second Lens Maker’s Equation tab lets you derive a focal length directly from glass refractive index and surface radii.

The thin lens equation

All thin-lens (paraxial) optics flows from one elegant formula:

1/f = 1/do + 1/di

where f is the focal length of the lens, do is the distance from the object to the lens, and di is the distance from the lens to the image. The equation applies equally to converging (convex) and diverging (concave) lenses, and to spherical mirrors, as long as the paraxial approximation holds — rays stay close to the optical axis.

Rearranging for each unknown:

  • Solve for image distance: di = (f × do) / (do − f)
  • Solve for object distance: do = (f × di) / (di − f)
  • Solve for focal length: f = (do × di) / (do + di)

Magnification describes how the image relates to the object:

m = −di / do

A positive m means upright; negative means inverted. |m| > 1 is magnified; |m| < 1 is reduced.

Optical power is simply the reciprocal of focal length in metres:

P = 1/f (unit: dioptre, D)

Optometrists write prescriptions in dioptres because lens powers add linearly when lenses are in contact.

The Lens Maker’s Equation

The Lens Maker’s Equation connects focal length to the physical glass properties:

1/f = (n − 1) × [1/R₁ − 1/R₂]

where n is the refractive index of the glass (crown glass ≈ 1.52, flint glass ≈ 1.62, borosilicate ≈ 1.47), R₁ is the radius of curvature of the first surface (positive if its centre of curvature lies to the right), and R₂ is the radius of the second surface. This equation lets optical engineers design lenses from scratch to hit a target focal length or dioptre specification.

Worked example: camera lens

A camera prime lens has a focal length of f = 50 mm = 0.050 m. A subject is do = 1.00 m away from the lens. Where does the sharp image form?

Using di = (f × do) / (do − f):

di = (0.050 × 1.000) / (1.000 − 0.050)
   = 0.050 / 0.950
   ≈ 0.05263 m  (≈ 52.6 mm behind the lens)

Magnification: m = −di/do = −0.05263/1.000 ≈ −0.053. The image is real, inverted, and reduced to about 5% of the subject’s size — exactly what a sensor captures.

Focal lengthObject distanceImage distanceMagnification
50 mm1.00 m52.6 mm−0.053×
50 mm0.20 m100 mm−0.50×
50 mm0.10 m∞ (at focus)
−50 mm (diverging)1.00 m−47.6 mm+0.048×

Sign convention note

This calculator uses the real-is-positive (Cartesian) convention:

  • Real objects: do > 0 (object on the incoming side)
  • Real images: di > 0 (image on the outgoing side, can be projected)
  • Virtual images: di < 0 (rays appear to diverge; only visible through the lens)
  • Converging lens: f > 0
  • Diverging lens: f < 0

Every result includes step-by-step algebra so you can check each substitution, and a colour-coded SVG ray diagram that updates live as you type. No data leaves your browser — the entire calculation runs in JavaScript.

Ad placeholder (rectangle)