Thin Lens Calculator: Lens and Mirror Equations, Magnification and Ray Diagram
By FindMySum · Last reviewed
Lenses and curved mirrors form images by bending or reflecting light so that rays from each point of an object meet again, or appear to. One short equation describes where that happens. This thin lens calculator solves it for the image distance, the object distance or the focal length of a lens or a spherical mirror, gives the magnification and the image's size and orientation, and draws a ray diagram. A third mode, the lensmaker's equation, works out a lens's focal length from the curvature of its surfaces and the glass it is made of.
The thin lens and mirror equation
1/f = 1/dₒ + 1/dᵢ
- f is the focal length: where parallel rays meet (or seem to come from) after the lens or mirror
- dₒ is the distance from the object to the lens or mirror
- dᵢ is the distance from the lens or mirror to the image
The magnification is m = −dᵢ ÷ dₒ, and the image height is m times the object height. The same equation works for spherical mirrors, where f is half the radius of curvature, R ÷ 2.
Sign convention
The calculator uses the real-is-positive convention from OpenStax University Physics.
- f > 0 for a converging (convex) lens or a concave mirror; f < 0 for a diverging (concave) lens or a convex mirror.
- dᵢ > 0 is a real image: behind a lens, or in front of a mirror, where light actually converges and a screen would show it.
- dᵢ < 0 is a virtual image: on the object's side of a lens, or behind a mirror.
- m < 0 means inverted; |m| > 1 means larger than the object.
Worked example: a 10 cm lens
The calculator opens with a converging lens of focal length 10 cm and an object 2 cm tall, 30 cm in front of it.
- 1/dᵢ = 1/10 − 1/30 = 2/30, so dᵢ = 15 cm
- m = −15 ÷ 30 = −0.5
- Image height = −0.5 × 2 = −1 cm
The image is real, 15 cm behind the lens, upside down and half size, which is what a camera or your eye does with a distant scene. Its power is 1 ÷ 0.10 m = 10 dioptres. Move the object to 20 cm, twice the focal length, and the image moves to 20 cm at the same size. Move it to 5 cm, inside the focal length, and dᵢ becomes −10 cm: a virtual, upright image twice the size, which is how a magnifying glass works.
The ray diagram
The diagram draws two principal rays from the top of the object. Ray 1 travels parallel to the axis, then bends through the far focal point (for a converging lens) or away from the near one (diverging). Ray 2 passes straight through the centre of the lens, or reflects off the mirror's centre at an equal angle. Where the outgoing rays cross is the real image. If they spread apart instead, dashed lines trace them backward to where they appear to come from, the virtual image. The dots mark the focal points.
Mirrors
Choose the mirror mode for a concave (f > 0) or convex (f < 0) mirror. A concave mirror with f = 10 cm and an object at 15 cm forms a real, inverted image 30 cm in front of it, twice the size: the principle of a shaving mirror or a reflecting telescope. A convex mirror always gives a small, upright, virtual image, which is why it is used on cars and in shops to show a wide view. The radius of curvature is shown as R = 2f.
The lensmaker's equation
A thin lens's focal length depends on its two surface radii and on how much more strongly the glass bends light than its surroundings do:
1/f = (n_lens ÷ n_medium − 1)(1/R₁ − 1/R₂)
R₁ is the surface the light meets first. A radius is positive when its centre of curvature lies on the side the light exits toward, so a biconvex lens has R₁ > 0 and R₂ < 0; enter 0 for a flat surface. With crown glass (n = 1.52) and radii of 20 cm and −20 cm, f = 19.2 cm in air. Under water (n = 1.333) the same lens has f = 71.3 cm, which is why your eyes cannot focus well underwater and why a diver's mask restores a layer of air.
Dioptres and eyeglasses
Optical power, P = 1/f with f in metres, is measured in dioptres (D). Converging lenses for long sight or reading have positive power; diverging lenses for short sight have negative power. A prescription of −2.00 D means a lens with a focal length of −50 cm. For thin lenses in contact, powers add.
Limits
The equations are for thin lenses and paraxial rays, those close to and nearly parallel with the axis. Thick lenses, wide apertures and off-axis rays bring in aberrations, and the refractive index changes with colour, so blue light focuses slightly closer than red. Optical design software traces real rays through every surface for that reason.
More questions
How does a camera focus?
The lens's focal length is fixed, so to focus on a nearer subject the lens moves farther from the sensor. For a 50 mm lens, a subject at infinity focuses 50 mm behind it and a subject at 1 m about 52.6 mm behind it, which is the extra 2.6 mm the focus ring moves the glass.
How does the human eye focus if its distance to the retina is fixed?
It changes the focal length instead. Muscles around the eye's flexible lens make it rounder for near objects and flatter for far ones. With age the lens stiffens (presbyopia), the near point moves away, and reading glasses add converging power, usually +1 to +3 dioptres.
What is the difference between a real and a virtual image?
Light actually passes through a real image, so it can be caught on a screen, as in a projector or camera. A virtual image is where rays appear to come from after a lens or mirror has bent them, as in a magnifying glass or a bathroom mirror; no light reaches that point and no screen can show it.
Why is a plane mirror image the same size and reversed left to right?
A flat mirror has an infinite focal length, so the mirror equation gives dᵢ = −dₒ and m = +1: a virtual, upright image as far behind the mirror as the object is in front. What looks like a left–right swap is really a front–back reversal along the line of sight.
How do two lenses in a row combine?
Treat the image from the first lens as the object for the second. For thin lenses touching each other the powers add: a +5 D and a +3 D lens act like one +8 D lens. Microscopes and telescopes chain an objective and an eyepiece this way, multiplying their magnifications.
What is focal length in a telephoto or wide-angle lens?
For a camera, focal length sets the field of view for a given sensor size. Longer focal lengths (telephoto, 200 mm) magnify a narrow view; shorter ones (wide-angle, 16 mm) take in a wide scene. The thin lens equation still describes where each lens focuses, although real camera lenses contain many elements.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.