Thin Lens Calculator
Find image distance, magnification and optical power from object and focal distances, with signed results for real and virtual images.
What it does
A thin lens is one whose thickness is small compared with the radii of its two surfaces, so the bending of light can be treated as happening at a single plane. That idea gives the thin lens equation, which OpenStax states as 1/do + 1/di = 1/f. Given any two of the three distances, the third follows from one reciprocal calculation.
The object distance do is measured from the centre of the lens to the object, and the image distance di is measured from the centre to the image. Light is taken to travel from left to right. A real object sits on the incoming side and has a positive do. A real image forms on the outgoing side and has a positive di. If the rays only appear to come from a point on the incoming side, the image is virtual and di is negative.
Focal length carries the sign of the lens. A converging lens brings parallel rays to a real focus and has positive f. A diverging lens makes parallel rays appear to spread from a virtual focus and has negative f. The same sign rule makes the thin lens equation work for both without changing its form.
Magnification m equals minus di over do. Its size says how much bigger or smaller the image is, and its sign says the orientation: a negative m is an inverted image and a positive m is upright. Multiply m by the object height to get the image height, with the same sign convention.
This page solves the equation for the image distance, then reports the magnification, image height, image type and optical power in diopters. All lengths are in centimetres, the unit most optics problems use. The model is the paraxial thin lens, so thick lenses, strong curvature and wide beams sit outside its range.
How to use
- Enter the object distance in centimetres, measured from the centre of the lens.
- Enter the focal length in centimetres. Use a positive value for a converging lens and a negative value for a diverging lens.
- Enter the object height in centimetres if you want the image height as well.
- Read the image distance first. A positive result is a real image on the far side, and a negative result is a virtual image on the object side.
- Read the magnification and image height next. A negative sign means the image is inverted.
- Read the optical power last. It is the reciprocal of the focal length in metres and is quoted in diopters.
Formula
- do
- Object distance from the lens centre, in cm, positive for a real object.
- di
- Image distance from the lens centre, in cm, positive for a real image.
- f
- Focal length in cm, positive for converging and negative for diverging.
- m
- Magnification, the ratio of image height to object height, also written as -di/do.
- ho
- Object height in cm.
- hi
- Image height in cm, negative when the image is inverted.
- P
- Optical power in diopters, the reciprocal of focal length in metres.
Keep every length in the same unit before taking reciprocals. This page uses centimetres and converts to metres only for the diopter result. An object placed exactly at the focal point gives 1/do - 1/f = 0, so the image is at infinity and there is no finite answer, which the tool reports as an error. For a diverging lens the focal length is negative, and the equation then always returns a negative image distance for a real object. The thin lens model assumes paraxial rays, meaning rays close to the optical axis.
Worked example
Example: a 3 cm object 60 cm from a 20 cm lens
Defaults: object distance 60 cm, focal length +20 cm, object height 3 cm.
- Reciprocal difference: 1/20 - 1/60 = (3 - 1)/60 = 2/60 = 1/30 per cm.
- Image distance: di = 1 / (1/30) = 30.00 cm, positive so the image is real.
- Magnification: m = -30/60 = -0.5, so the image is inverted and half the object height.
- Image height: hi = -0.5 x 3 = -1.50 cm.
- Optical power: P = 100/20 = 5.00 D.
- The tool shows 30.00 cm, -0.5 x, Real and inverted, -1.50 cm and 5.00 D.
Reference table
| Lens and object position | Image distance | Magnification | Image type |
|---|---|---|---|
| Converging f = +20 cm, do = 60 cm | 30.00 cm | -0.5 x | Real and inverted |
| Converging f = +20 cm, do = 40 cm | 40.00 cm | -1 x | Real and inverted |
| Converging f = +20 cm, do = 15 cm | -60.00 cm | 4 x | Virtual and upright |
| Diverging f = -20 cm, do = 60 cm | -15.00 cm | 0.25 x | Virtual and upright |
| Converging f = +20 cm, do = 1000 cm | 20.41 cm | -0.02 x | Real and inverted |
Limits
- The thin lens approximation needs the lens thickness to be small next to both surface radii and the object and image distances.
- Only paraxial rays are modelled, so the page says nothing about spherical aberration, coma or chromatic aberration.
- A single lens in air is assumed. A lens in water or another medium changes focal length and needs a different input focal length.
- An object at the focal point gives an image at infinity, which has no finite distance and is reported as an error.
Common mistakes
- Forgetting the minus sign in m = -di/do and calling a real image upright.
- Entering a positive focal length for a diverging lens, which flips the image from virtual to real.
- Mixing units, for example a focal length in millimetres with an object distance in centimetres.
- Reading a negative image distance as a mistake rather than as a virtual image on the object side.
- Expecting a finite answer when the object sits exactly at the focal point.
Try it yourself
Quick checks. Answers sit tucked under each question.
A 2 cm object sits 30 cm from a converging lens of focal length 10 cm. Where is the image and how tall is it?
di = 10 x 30 / (30 - 10) = 15 cm, real. m = -15/30 = -0.5, so hi = -1 cm and the image is inverted. The tool shows 15.00 cm, -0.5 x, Real and inverted, -1.00 cm and 10.00 D.
What does the tool give for a diverging lens of focal length 20 cm with a 4 cm object 60 cm away?
Use f = -20 cm. di = -20 x 60 / (60 + 20) = -15.00 cm, a virtual image. m = 0.25, so hi = 1.00 cm upright, and the power is -5.00 D.
An object is 15 cm from the 20 cm lens in the example. What changes?
di = 20 x 15 / (15 - 20) = -60.00 cm, so the image is virtual and upright. m = 4 x, hi = 12.00 cm and the power stays 5.00 D.
Questions
What is the thin lens equation?
It is 1/do + 1/di = 1/f, linking object distance, image distance and focal length. Rearranged, the image distance is f x do divided by do minus f.
Why is the magnification negative?
The minus sign in m = -di/do marks an inverted image. A real image formed by a single converging lens is inverted, so its magnification is negative.
What does a negative image distance mean?
The image is virtual. It sits on the same side of the lens as the object and cannot be caught on a screen. A diverging lens always gives a negative di for a real object.
How do I find optical power from focal length?
Convert the focal length to metres and take its reciprocal. A 20 cm lens is 0.20 m, so its power is 1/0.20 = 5.00 D. The tool does the conversion for you.
Can I use millimetres instead?
Yes, but every length must use the same unit. If you enter millimetres, the image distance and height come back in millimetres. The diopter result still needs a conversion to metres, so centimetres are simpler here.
Does this work for a camera or the human eye?
It gives the first order answer for one thin element. A camera lens or the eye has several surfaces and a real thickness, so a full design needs a thick lens or multi element model.
Sources
- OpenStax University Physics Volume 3, 2.4 Thin Lenses
- Oregon State University BoxSand, Thin Lens Equation: Fundamentals
- OpenStax University Physics Volume 3, Chapter 2 Key Equations