Photonica
Tool · Imaging and diffraction

Thin Lens Calculator

Where does a lens put the image, how large is it, and is it real or virtual? From the focal length and the object distance the calculator solves the thin lens equation, draws the ray diagram, and handles a second lens for relays, microscopes and telescopes. Background: image plane, focal length, lens, and ABCD matrices.

Lens and object
The object distance is measured from the object to the first lens. Lenses are thin and in air; for a thick lens or a lens made from given radii and glass, see the lensmaker’s equation in the focal length entry.
Presets
Readouts
Ray diagram
Learn with it

Three short experiments. Each one sets the inputs, says where to look, and asks for a prediction before it shows the result.

Checked against

These checks run in your browser on every load. The thin-lens equation is compared with cases worked out by hand and with Newton’s form, rays are traced through the lens to confirm that they cross at the computed image, and the two-lens formulas are checked against the ray-transfer matrix of the pair.

CheckExpectedComputedTolerance

The expected values follow the thin-lens and ray-matrix results in Hecht, Optics, and Pedrotti, Introduction to Optics, evaluated by hand for the stated cases. The tolerance is the largest difference from Expected that still passes, relative to Expected or to 1, whichever is larger.

The model

A thin lens of focal length ff images an object at distance ss in front of it to an image at distance s′s' behind it, with lateral magnification mm:

1s+1s′=1f,m=−s′s\frac{1}{s} + \frac{1}{s'} = \frac{1}{f}, \qquad m = -\frac{s'}{s}

in the real-is-positive convention: f>0f > 0 for a converging lens, s′>0s' > 0 for a real image behind the lens, and s′<0s' < 0 for a virtual image on the object side. A negative mm means the image is inverted. Measured from the focal points instead, the same relation is Newton’s form (s−f)(s′−f)=f2(s - f)(s' - f) = f^2. For two lenses a distance dd apart, the image of the first becomes the object of the second at s2=d−s1′s_2 = d - s_1', the magnifications multiply, and the pair acts as one lens of effective focal length

f=f1f2f1+f2−d.f = \frac{f_1 f_2}{f_1 + f_2 - d}.

The model is paraxial and treats each lens as having no thickness, so it gives the image position and size but not aberrations; a real lens of appreciable thickness is described by its principal planes, from which the same equations hold.

Worked example

A lens of 100 mm focal length with an object 150 mm in front of it forms a real, inverted image 300 mm behind it, magnified twice (m = −2). Moved to 50 mm, inside the focal length, the object gives a virtual, upright image 100 mm in front of the lens, also twice the size: the lens is then a magnifying glass. A 50 mm camera lens focused on a subject 1 m away puts the image plane 52.632 mm behind the lens, 2.632 mm further out than for a subject at infinity.

References: E. Hecht, Optics, 5th ed. (Pearson, 2017), ch. 5 and 6. F. L. Pedrotti, L. M. Pedrotti and L. S. Pedrotti, Introduction to Optics, 3rd ed. (Cambridge University Press, 2018), ch. 2 and 18.