Thin Lens Equation Calculator

Find where a lens forms an image, how large it is, and whether it is real or virtual, for converging and diverging lenses.

🔭 Thin Lens Equation Calculator
Lens type
Unit of lengthlabel only, no conversion
Focal length and object distanceboth positive numbers
Focal length f
Object distance do
Object height (optional)gives the image height
Unit of lengthlabel only, no conversion
The image is
Measured distancesboth positive numbers
Object distance do
Image distance di
Lens type
Unit of lengthlabel only, no conversion
Focal length and wanted magnificationm is negative for an inverted image
Focal length f
Magnification m
Image distance di
—
Magnification m
—
Image type
—
Image height
—
Lens power
—

Focal length f
—
Lens type
—
Magnification m
—
Image type
—
Lens power
—

Object distance do
—
Image distance di
—
Image type
—
Lens power
—

Ray diagram, drawn to scale along the axis: the green arrow is the object, the blue ray travels parallel to the axis and then bends at the lens, the red ray passes straight through the center, and the orange arrow is the image (dashed when virtual, with dashed rays traced backward). F marks the focal points. Image heights are only to scale when they fit in the picture.

🔭 What is the Thin Lens Equation?

The thin lens equation tells you where a lens forms an image. It states that the reciprocal of the focal length equals the sum of the reciprocals of the object distance and the image distance: 1/f = 1/do + 1/di. Give it the focal length of a lens and the position of an object and it returns the position of the image. A second formula, m = −di/do, gives the magnification, so you also know how big the image is and whether it is the right way up. The approximation behind it is that the lens is thin enough for its thickness to be ignored compared with the distances involved.

Every instrument built around a lens depends on this relationship. A camera moves its lens until the image of the subject lands exactly on the sensor. A projector places the slide just outside the focal length so that a large, real image lands on a distant screen. A magnifying glass puts the object inside the focal length so that the eye sees an enlarged virtual image. Eyeglasses, microscopes and telescopes combine several lenses, and the output image of one is the input object of the next. The same equation covers diverging lenses, such as those used to correct short sight, once the focal length is given a negative sign.

The idea that most often trips people up is the sign convention. Textbooks differ, and this page uses the common real-is-positive convention: the object distance is positive for a real object, the image distance is positive when a real image forms behind the lens, and the focal length is positive for a converging lens. A negative image distance therefore means a virtual image, on the same side of the lens as the object, which cannot be shown on a screen. Also note that an object exactly at the focal point gives no finite image, because the light leaves the lens as a parallel beam.

The three modes match common problems. Find the image solves for di, m and the image height. Find f works backwards from distances measured on an optical bench. Find the object tells you where to put the object for a magnification you want, such as the projector or enlarger problem. Each shows a to-scale principal-ray diagram and a chart of image distance against object distance, so you can see the jump that happens as the object crosses the focal point. To get the focal length from a lens's glass and its curves, use the lens maker equation calculator, and for the bending of light itself the index of refraction calculator.

📐 Formula

1/f = 1/do + 1/di    m = −di / do = hi / ho
f = focal length. Positive for a converging (convex) lens, negative for a diverging (concave) lens.
do = distance from the lens to the object, positive for a real object.
di = distance from the lens to the image. Positive for a real image (opposite side to the object), negative for a virtual image.
m = lateral magnification. Negative means inverted, positive means upright. |m| above 1 means magnified.
Solved for di: di = do f / (do − f). At do = f the denominator is zero and the image is at infinity.
Object for a magnification: do = f (m − 1) / m.
Power: P = 1/f in dioptres when f is in metres.
Example: f = 10 cm, do = 30 cm: 1/di = 1/10 − 1/30 = 1/15, so di = 15 cm and m = −0.5.

📖 How to Use This Calculator

Steps

1
Choose a mode. Use Find the image when you know the lens and the object, Find f when you have measured both distances, or Find the object when you want a certain magnification.
2
Set the lens type and the unit. Choose converging or diverging, set the length unit label, and type the focal length as a positive number. The sign is applied for you.
3
Enter the distances. Type the object distance and, if you like, the object height. In Find f mode enter the image distance and say whether the image is real or virtual.
4
Read the image. You get the image distance, the magnification, the image height and a plain description. The ray diagram and chart show where the image forms and where your object sits on the curve.

💡 Example Calculations

Example 1 — Object Beyond Twice the Focal Length

Converging lens, f = 10 cm, object 5 cm tall at do = 30 cm

1
1/di = 1/10 − 1/30 = 0.066667, so di = 15.000 cm, positive, so the image is real.
2
m = −15 / 30 = −0.5000.
3
Image height = −0.5 × 5 = −2.500 cm: real, inverted and reduced.
di = 15.000 cm, m = −0.5000
Try this example →

Example 2 — A Magnifying Glass

Converging lens, f = 10 cm, a 2 cm object at do = 6 cm (inside the focal length)

1
di = 6 × 10 / (6 − 10) = −15.000 cm. The negative sign means a virtual image.
2
m = −(−15) / 6 = +2.5000.
3
Image height = 2.5 × 2 = 5.000 cm: virtual, upright and magnified.
di = −15.000 cm, m = 2.5000
Try this example →

Example 3 — A Diverging Lens

Diverging lens with |f| = 20 cm, a 6 cm object at do = 30 cm

1
f = −20 cm. 1/di = −1/20 − 1/30 = −0.083333, so di = −12.000 cm.
2
m = 12 / 30 = +0.4000.
3
Image height = 0.4 × 6 = 2.400 cm: virtual, upright and reduced, as always for a diverging lens.
di = −12.000 cm, m = 0.4000
Try this example →

Example 4 — Object at the Focal Point

Converging lens, f = 10 cm, object at do = 10 cm

1
1/di = 1/10 − 1/10 = 0.
2
di would be infinite, so the rays leave the lens parallel.
3
No image forms at any finite distance, and the magnification is undefined.
Result = No image (at infinity)
Try this example →

Example 5 — Finding f on an Optical Bench

A sharp real image forms 24 cm from the lens when the object is 40 cm away

1
1/f = 1/40 + 1/24 = 0.025 + 0.041667 = 0.066667.
2
f = 15.000 cm, positive, so the lens is converging. Its power is 1 / 0.15 m = 6.667 D.
3
m = −24 / 40 = −0.6000.
f = 15.000 cm, m = −0.6000
Try this example →

Example 6 — Placing the Slide in a Projector

Converging lens, f = 10 cm, wanted magnification m = −2

1
do = f (m − 1) / m = 10 × (−3) / (−2) = 15.000 cm.
2
di = −m do = 2 × 15 = 30.000 cm.
3
Check: 1/15 + 1/30 = 0.1 = 1/10. The image is real, inverted and magnified, so the slide goes in upside down.
do = 15.000 cm, di = 30.000 cm
Try this example →

Example 7 — A Camera Lens

A 50 mm lens photographs a person 1700 mm tall standing 2000 mm away

1
di = 2000 × 50 / (2000 − 50) = 51.282 mm, so the lens sits 1.282 mm beyond its infinity focus position.
2
m = −51.282 / 2000 = −0.0256.
3
Image height = −0.0256 × 1700 = −43.590 mm, inverted. That is taller than a 36 mm sensor edge, so the photographer would need to step back to fit the whole person.
di = 51.282 mm, image height = −43.590 mm
Try this example →

❓ Frequently Asked Questions

What is the thin lens equation?+
The thin lens equation is 1/f = 1/do + 1/di, where f is the focal length, do the distance from the lens to the object and di the distance from the lens to the image. With f = 10 cm and do = 30 cm, 1/di = 1/10 - 1/30, so di = 15 cm.
How do you calculate the magnification of a lens?+
Magnification is m = -di/do, which also equals image height divided by object height. A negative value means the image is inverted. For do = 30 cm and di = 15 cm, m = -0.5, an inverted image half the size of the object.
What sign convention does the thin lens equation use?+
This calculator takes distances to a real object and a real image as positive, a converging lens as having positive f and a diverging lens as negative f. A negative image distance means a virtual image on the same side of the lens as the object.
When is the image from a converging lens real or virtual?+
If the object is farther than the focal length, the image is real, inverted and formed on the opposite side. If the object is inside the focal length, the image is virtual, upright and larger. At exactly f no image forms.
What happens when the object is at the focal point?+
The refracted rays leave the lens parallel, so the image distance is infinite and no image forms at any finite distance. This is the principle behind a collimated beam from a lamp placed at the focus of a lens.
Does a diverging lens ever form a real image?+
Not from a real object. Its focal length is negative, so 1/di = 1/f - 1/do is always negative. The image is virtual, upright and reduced, lying between the lens and the focal point.
How do you find the focal length from object and image distances?+
Add the reciprocals, f = 1 / (1/do + 1/di), with di negative for a virtual image. An object at 40 cm with a real image at 24 cm gives 1/f = 1/40 + 1/24, so f = 15 cm.
How far should the object be to get a given magnification?+
Combine the two equations to get do = f (m - 1) / m. To get m = -2 with f = 10 cm, do = 10 x (-3) / (-2) = 15 cm, and the image forms at 30 cm.
How is a camera lens related to the lens equation?+
A camera focuses by moving the lens until di matches the equation. A 50 mm lens on a subject 2 m away forms the image 51.28 mm behind the lens, with a magnification of -0.0256.
What is the difference between the thin lens equation and the lensmaker's equation?+
The thin lens equation links object and image positions for a lens whose focal length is known. The lensmaker's equation gives that focal length from the glass and the curvature of the two faces.
Can the thin lens equation be used for thick lenses?+
Only approximately. It assumes the lens is thin compared with the distances involved. For a thick lens, distances are measured from the principal planes rather than from the lens surface.

What is the thin lens equation?

The thin lens equation is 1/f = 1/do + 1/di, where f is the focal length, do the distance from the lens to the object and di the distance from the lens to the image. With f = 10 cm and do = 30 cm, 1/di = 1/10 - 1/30, so di = 15 cm.

How do you calculate the magnification of a lens?

Magnification is m = -di/do, which also equals image height divided by object height. A negative value means the image is inverted. For do = 30 cm and di = 15 cm, m = -0.5, an inverted image half the size of the object.

What sign convention does the thin lens equation use?

This calculator takes distances to a real object and a real image as positive, a converging lens as having positive f and a diverging lens as negative f. A negative image distance means a virtual image on the same side of the lens as the object.

When is the image from a converging lens real or virtual?

If the object is farther than the focal length, the image is real, inverted and formed on the opposite side. If the object is inside the focal length, the image is virtual, upright and larger. At exactly f no image forms.

What happens when the object is at the focal point?

The refracted rays leave the lens parallel, so the image distance is infinite and no image forms at any finite distance. This is the principle behind a collimated beam from a lamp placed at the focus of a lens.

Does a diverging lens ever form a real image?

Not from a real object. Its focal length is negative, so 1/di = 1/f - 1/do is always negative. The image is virtual, upright and reduced, lying between the lens and the focal point.

How do you find the focal length from object and image distances?

Add the reciprocals, f = 1 / (1/do + 1/di), with di negative for a virtual image. An object at 40 cm with a real image at 24 cm gives 1/f = 1/40 + 1/24, so f = 15 cm.

How far should the object be to get a given magnification?

Combine the two equations to get do = f (m - 1) / m. To get m = -2 with f = 10 cm, do = 10 x (-3) / (-2) = 15 cm, and the image forms at 30 cm.

How is a camera lens related to the lens equation?

A camera focuses by moving the lens until di matches the equation. A 50 mm lens on a subject 2 m away forms the image 51.28 mm behind the lens, with a magnification of -0.0256.

What is the difference between the thin lens equation and the lensmaker's equation?

The thin lens equation links object and image positions for a lens whose focal length is known. The lensmaker's equation gives that focal length from the glass and the curvature of the two faces.

Can the thin lens equation be used for thick lenses?

Only approximately. It assumes the lens is thin compared with the distances involved. For a thick lens, distances are measured from the principal planes rather than from the lens surface.