Lens Equation Calculator
Solve the thin lens equation for image distance, focal length or magnification, with sign conventions for real and virtual images explained step by step.
Lens Equation Calculator
Every camera, microscope, eyeglass prescription and projector is a solution to the same equation. Put an object at a known distance from a lens of known focal length and the thin lens equation tells you exactly where the image lands and how big it will be. Get the distances wrong and the picture is blurry; get the sign convention wrong and you will confidently predict a real image where physics puts a virtual one.
This calculator solves the thin lens equation in the three directions people actually need it: find the image distance from the focal length and object distance, find the focal length from both distances, or find the magnification from the geometry of the image. It reports whether the image is real and inverted or virtual and upright, and it returns the lens power in dioptres, which is the number written on an eyeglass prescription. The refraction that makes a lens work is the subject of the Snell's Law Calculator; the wave side of light is covered in the Wavelength Calculator.
All distances are in centimetres. A positive focal length means a converging (convex) lens; a negative focal length means a diverging (concave) lens. The calculator follows the Cartesian sign convention, which is the same one used in most physics textbooks.
Example 1 — an object outside the focal point. A converging lens has a focal length of 10 cm and the object sits 30 cm away, which is three focal lengths. Enter 10 and 30. The image distance is 15.000 cm, the magnification is −0.500, the image is Real and inverted, and the lens power is 10.00 D. Because the image is real, it can be projected onto a screen — this is the projector and camera arrangement.
Example 2 — an object inside the focal point. Keep the focal length at 10 cm and move the object to 5 cm. The image distance becomes −10.000 cm: the negative sign means the image forms on the same side as the object, so it cannot be projected. The magnification is +2.000 and the image is Virtual and upright. That is a magnifying glass, and it explains why you have to hold it at arm's length from the page to see a sharp, enlarged image.
Example 3 — recovering the focal length. Switch to Focal length, enter an object distance of 30 cm and an image distance of 15 cm. The calculator returns a focal length of 10.000 cm, 10.00 D of power and a magnification of −0.500. This is the mode to use when you measure where an image actually forms on an optical bench and want the lens's focal length without trusting the label.
Example 4 — the size of the image. In Magnification mode, enter the same 30 cm and 15 cm distances and an object height of 5 cm. The magnification is −0.500, the image is half the size of the object, and the image height is −2.500 cm. The negative height is not a negative size; it encodes that the image is upside down.
Working Example 1 by hand. Start from the reciprocals: 1 divided by 10 is 0.1, and 1 divided by 30 is 0.0333. Subtract them because the image-distance form rearranges the equation, which leaves 0.0667. Invert that to get the image distance, 15 cm. The magnification is minus 15 over 30, or −0.5. Lens power is 1 divided by the focal length in metres, so 1 divided by 0.1 gives 10 dioptres. Every value the calculator returns is one of those four arithmetic steps, which makes the sign convention easy to check when an answer looks odd.
The thin lens equation ties the object distance, the image distance and the focal length together:
Here d_o is the distance from the object to the lens, d_i the distance from the lens to the image, and f the focal length. Solving for the image distance gives the form the calculator uses first:
The magnification follows directly from the same triangle geometry, and its sign carries the orientation:
Three readings come out of that minus sign. A positive d_i puts the image on the far side of the lens, where light actually converges — a real image — and the magnification is then negative, so the image is inverted. A negative d_i puts the image on the same side as the object, where no light converges — a virtual image — and the magnification is positive, so the image is upright.
Lens power, the number opticians use, is just the reciprocal of the focal length in metres:
so a 10 cm focal length is 10 dioptres, and a −50 cm focal length is −2 dioptres. Stronger lenses have shorter focal lengths and larger dioptre values.
The equation says nothing about brightness, which is set by the aperture rather than the focal length. The two are linked by the f-number, the ratio photographers use:
where D is the diameter of the opening. A 50 mm lens with a 25 mm opening is at f/2; the same lens stopped to a 12.5 mm opening is at f/4 and passes a quarter of the light. That ratio is why the same subject framed the same way needs four times the exposure at f/4 as at f/2, and why the aperture also sets the depth of field that the thin lens equation alone does not describe.
The equation has one singularity worth knowing. When the object sits exactly at the focal point (d_o = f), the two fractions on the right are equal, the denominator of the image-distance form goes to zero, and the image forms at infinity — the rays leave the lens parallel. The calculator reports that case rather than a huge number.
For a converging lens of focal length f, the character of the image depends entirely on where the object sits relative to the focal point and to twice the focal length.
| Beyond 2f | Between f and 2f | Between 0 and −1 | Real, inverted, smaller | Camera, eye |
| At 2f | At 2f | −1 | Real, inverted, same size | 1:1 copy work |
| Between f and 2f | Beyond 2f | Below −1 | Real, inverted, larger | Projector, enlarger |
| At f | At infinity | Undefined | No image forms | Collimator |
| Inside f | Negative | Greater than +1 | Virtual, upright, larger | Magnifying glass |
The pattern in the chart is the reason photographers talk about focusing "toward infinity": far objects produce images just beyond the focal plane, so the lens has to move only a little to rack from a nearby subject to a distant one.
- Keep the sign convention consistent. Positive distances on the side where light goes and where the image forms; negative for a virtual image. If you flip conventions halfway through a problem, the answer will be wrong in a way that looks plausible.
- Use one unit throughout. The equation is scale-free, so centimetres and metres both work, but mixing them does not. The power result is the exception: it is always computed in dioptres from the focal length in metres, so the calculator converts for you.
- Remember that focal length fixes the field. A shorter focal length gives a wider field of view and a smaller image for a distant object; that is exactly why a 24 mm lens is called wide and a 200 mm lens is called long.
- Check the answer against the table. If you calculated a real image for an object inside the focal point, one of the distances has the wrong sign. The five cases in the reference table are a fast consistency check.
- Treat
d_o = fas a special case, not an error. It is the collimator setting: rays leave parallel, the image is at infinity, and no screen will ever show it. - For diverging lenses use a negative focal length. The same equation covers them; the image comes out virtual and smaller, on the object side, which matches what a concave lens actually does.
The model is the thin lens equation: it ignores the lens thickness, treating the two surfaces as coincident. For a spectacle lens a few millimetres thick that is an excellent approximation; for a camera lens containing eight elements it is not, and real designs are ray-traced element by element. Spherical aberration, coma and chromatic aberration are all outside the model, which is why a simple calculation gives the paraxial image and not necessarily a sharp one.
The equation also assumes the paraxial approximation — rays close to the axis and small angles — where the sine of an angle is well approximated by the angle itself. Wide-angle lenses violate this, and their actual image distances differ from the prediction near the edges of the frame.
Finally, mirrors use the same relation with the same signs, so the mirror equation is numerically identical, but the geometry of what counts as "behind" reverses. The calculator reports distances for lenses; when applying the numbers to a mirror, interpret the sign of the image distance in mirror terms before trusting the "real or virtual" label.
- ❓ What is the thin lens equation?
- ✅ It is 1/f = 1/do + 1/di, relating the focal length to the object and image distances. It follows from the paraxial approximation of refraction at a spherical surface.
- ❓ How do I know if an image is real or virtual?
- ✅ Look at the sign of the image distance. Positive means the light converges on the far side and the image is real and inverted; negative means the rays only appear to diverge from a point, so the image is virtual and upright.
- ❓ Why is the magnification negative?
- ✅ The minus sign encodes orientation, not size. A negative magnification means the image is inverted relative to the object, which happens whenever a single lens forms a real image.
- ❓ What happens when the object is exactly at the focal point?
- ✅ The rays leave the lens parallel and the image forms at infinity. No finite image distance exists, so the calculator reports the condition rather than a very large number.
- ❓ What is a dioptre?
- ✅ The reciprocal of the focal length in metres. A lens with a 50 cm focal length has a power of 2 dioptres, and prescriptions add powers when lenses are stacked.
- ❓ How does a magnifying glass work?
- ✅ The object sits inside the focal length, so the image distance is negative and the magnification is positive and larger than one. The image is virtual, upright and farther away, which is why it looks bigger.
- ❓ Can I use this for a concave lens?
- ✅ Yes. Enter a negative focal length. The image distance comes out negative and the magnification positive but smaller than one, which matches the reduced, upright virtual image a diverging lens produces.
- ❓ Does the same equation apply to mirrors?
- ✅ Numerically yes, with the same signs, but the interpretation of the near and far sides reverses. Concave mirrors behave like converging lenses and convex mirrors like diverging ones.
- ❓ Why do camera lenses have more than one element?
- ✅ A single thin lens cannot bring all colours and all ray heights to the same focus. Multiple elements correct chromatic and spherical aberration, which the thin lens equation does not describe.
- ❓ How do I find image height?
- ✅ Multiply the object height by the magnification. The sign tells you whether the image is inverted; the absolute value tells you how large it is compared with the object.
- ❓ What if the object distance is smaller than the focal length?
- ✅ The image distance is negative and the image is virtual, upright and magnified. This is the magnifier case, and it is the only configuration where a single converging lens makes an enlarged upright image.
References
- [1]OpenStax. (2020). College Physics 2e, Section 25.6: Image Formation by Lenses. Retrieved from openstax.org
- [2]Nave, C. R. (n.d.). Thin Lens Equation. HyperPhysics, Georgia State University. Retrieved from hyperphysics.phy-astr.gsu.edu
- [3]The Physics Classroom. (n.d.). The Mathematics of Lenses. Retrieved from physicsclassroom.com
- [4]Wikipedia. (n.d.). Lens. Retrieved from en.wikipedia.org
- [5]Wikipedia. (n.d.). Magnification. Retrieved from en.wikipedia.org
- [6]OpenStax. (2020). College Physics 2e, Section 25.7: Image Formation by Mirrors. Retrieved from openstax.org
Last updated: October 19, 2026
UnByte — Independent Software Engineering
Every calculator references authoritative sources — Editorial policy
