Lens & mirror equation: the thin-lens and mirror equation 1/f = 1/dₒ + 1/dᵢ links an optic’s focal length to where an object sits and where its image forms. This free calculator solves for focal length, object distance or image distance — in any unit — and reports the magnification with every step of the working.
A single equation describes image formation by any thin lens or spherical mirror: 1/f = 1/dₒ + 1/dᵢ. Here f is the focal length, dₒ is the distance from the optic to the object, and dᵢ is the distance to the image. Because the relationship is identical for lenses and mirrors, the same calculator handles both — you just supply the focal length with the correct sign.
There are three steps. First, decide which quantity you want — focal length, object distance or image distance — and select it in the Solve for menu. Second, enter the two distances you already know and pick their units (centimetres are typical in optics, but millimetres and metres are available); the calculator converts everything to SI metres behind the scenes. Third, read the answer together with the worked steps, which show the equation, your numbers substituted in, and the result. When you solve for an image or object distance, the calculator also reports the magnification m = −dᵢ/dₒ.
The equation rearranges cleanly. To find the image distance, use dᵢ = 1 / (1/f − 1/dₒ); to find the object distance, swap dᵢ for dₒ; to find the focal length, take the reciprocal of 1/dₒ + 1/dᵢ. Signs carry meaning: a positive dᵢ is a real image you could catch on a screen, while a negative dᵢ is a virtual image. A negative magnification means the image is inverted, and a magnitude above one means it is enlarged. For the bending of light that produces these images at a surface, see the Snell's law calculator.
Keep the sign convention consistent and the algebra does the rest. Converging lenses and concave mirrors take a positive f; diverging lenses and convex mirrors take a negative f. The most common mistake is mixing units between the two distances — letting the calculator convert removes that risk entirely.
An object sits 30 cm in front of a converging lens with a focal length of 10 cm. The image distance is dᵢ = 1 / (1/10 − 1/30) = 1 / (0.1 − 0.0333) = 15 cm. Because dᵢ is positive, the image is real. The magnification is m = −dᵢ/dₒ = −15/30 = −0.5, so the image is inverted and half the height of the object — exactly what a camera lens does when it projects a scene onto its sensor.
The lens and mirror equation is the foundation of every imaging device — eyeglasses and contact lenses, cameras and phone optics, microscopes, telescopes and the human eye. Predicting where an image forms, whether it is real or virtual, and how large it appears is the first step in designing or correcting any optical system.
It is 1/f = 1/dₒ + 1/dᵢ, where f is the focal length, dₒ is the object distance and dᵢ is the image distance. The same single equation works for both thin lenses and spherical mirrors, which is why one calculator covers both. Rearranging it lets you find any one of the three quantities from the other two.
Using the “real-is-positive” convention: object distance dₒ is positive for a real object in front of the lens or mirror. A converging (convex) lens and a concave mirror have positive focal length f; a diverging (concave) lens and a convex mirror have negative f. A positive image distance dᵢ means a real image on the far side (lens) or same side (mirror) as where light actually goes; a negative dᵢ means a virtual image.
Magnification is m = −dᵢ/dₒ. A negative value means the image is inverted; a positive value means it is upright. The size of m tells you the scale: |m| greater than 1 is enlarged, less than 1 is reduced. For example dᵢ = 15 cm and dₒ = 30 cm give m = −0.5, a real image that is inverted and half the object’s height.
A negative image distance means the image is virtual — it forms on the same side as the object and cannot be projected onto a screen. This happens when an object is inside the focal length of a converging lens (a magnifying glass) or with any diverging lens or convex mirror. The calculator returns the sign for you so you can tell real images from virtual ones.
If dₒ equals f, then 1/f − 1/dₒ = 0 and the image distance becomes infinite — the rays leave parallel and no sharp image forms at any finite distance. The calculator detects this divide-by-zero case and reports that there is no valid finite solution rather than showing infinity.
Read more: Reflection and refraction of light