Thin lens calculator
Enter any two values, get the third and the magnification.
What is the thin lens equation?
1/dₒ + 1/dᵢ = 1/f, where dₒ is the object distance, dᵢ the image distance and f the focal length. Magnification is m = −dᵢ ÷ dₒ (OpenStax University Physics).
Example
An object 30 cm from a converging lens with f = 10 cm: 1/dᵢ = 1/10 − 1/30, so dᵢ = 15 cm. m = −15 ÷ 30 = −0.5 — a real, inverted image half the size.
What do the signs mean?
f is positive for a converging lens and negative for a diverging one. A positive image distance means a real image on the far side of the lens; a negative one means a virtual image on the same side as the object. Negative magnification means the image is upside down.
What happens inside the focal length?
With a converging lens and the object closer than f, the image distance comes out negative: an upright, enlarged virtual image — how a magnifying glass works.
What is lens power in diopters?
Power = 1 ÷ f with f in meters. A lens with f = 0.5 m has a power of 2 diopters.
What happens when the object is exactly at the focal point?
The rays leave the lens parallel, so no image forms at any finite distance (the image is at infinity). The equation has no solution, and the calculator reports that it cannot find one. The same fact is used to make a parallel beam: a lamp placed at the focal point of a converging lens sends out parallel rays.
How do I find the focal length of an unknown lens?
Measure the object distance and the sharp image distance on a screen and leave f blank. An object 60 cm from the lens that produces a sharp image 12 cm on the other side gives 1/f = 1/60 + 1/12, so f = 10.0 cm and the magnification is -0.20. Measure from the lens itself; with a thick lens or a lens system, the thin-lens equation is only an approximation.
What the equation assumes
The equation 1/dₒ + 1/dᵢ = 1/f applies to a lens whose thickness is small compared with the distances involved, to rays close to the axis and not too steeply inclined (the paraxial approximation), to a single color of light, and to a lens in air or another uniform medium. Real lenses have aberrations that blur or distort the image, a thick lens needs principal planes, and a lens in water has a different focal length from the same lens in air. All three distances are measured from the lens and entered in centimeters here. Fill in any two fields, leave the third empty, and the calculator solves for it.
Worked example: moving the object toward a converging lens
Take a converging lens with f = 10 cm. With the object at 30 cm the image forms at 15.0 cm with magnification -0.50: real, inverted and half the size. At 20 cm, which is twice the focal length, the image is at 20.0 cm and m = -1.00: the same size, upside down. At 15 cm the image moves out to 30.0 cm and m = -2.00: larger, still inverted. Inside the focal length, at 5 cm, the image distance is -10.0 cm and m = +2.00: a virtual, upright image twice the size on the same side as the object, which is what you see through a magnifying glass.
A diverging lens always gives a virtual image
For a diverging lens, f is negative. With f = −15 cm and an object at 30 cm, 1/dᵢ = −1/15 − 1/30, so dᵢ = -10.0 cm and m = +0.33. The image is virtual, upright and smaller than the object, and it stays that way wherever the object is placed. The power of this lens is 1 ÷ (−0.15 m) = -6.7 diopters; eyeglasses for nearsightedness use diverging lenses with negative powers in this way.
Common mistakes
Using the wrong sign for f is the main one: converging lenses are positive and diverging lenses negative. A negative image distance is not an error; it means the image is virtual and cannot be projected on a screen. Mixing units, for example an object distance in meters and a focal length in centimeters, gives nonsense. Entering all three values leaves nothing to solve for (the calculator needs exactly one empty field). Finally, do not confuse the magnification m = −dᵢ ÷ dₒ with the angular magnification quoted for magnifying glasses and telescopes, which is a different quantity.
Sources: OpenStax University Physics, Volume 3, chapter 2 (geometric optics and image formation; section 2.5, thin lenses, with the sign conventions used here). Related: Snell's law calculator, wavelength calculator and speed calculator.