Lens & Mirror Equation Calculator
Find image distance and magnification for a lens or mirror, and see a live ray diagram showing whether the image is real or virtual, upright or inverted.
Calculator verified • Last updated: August 2026
—
Ray Diagram
Reading the diagramThe blue arrow is the object; the orange arrow (solid if real, dashed if virtual) is the image. One ray runs straight through the center undeviated; the other leaves parallel to the axis and bends through the focal point F. Where they meet (or appear to meet) is the image. The element itself changes with your inputs: outward arrows for a converging lens, inward arrows for a diverging lens, a curved reflective face for a mirror (concave or convex, matching the sign of f) — and for a mirror, a real image is drawn on the same side as the object, since reflected light never actually passes through to the other side, unlike a lens.
The Lens & Mirror Equation Explained
The same equation describes how both lenses and mirrors form images, relating the focal length to how far the object and image sit from the lens or mirror.
f: focal length of the lens or mirror, in meters or centimeters (sign shows converging vs. diverging).
d0: object distance from the lens or mirror, in the same length unit as f.
di: image distance from the lens or mirror, in the same length unit as f.
Magnification:
m: magnification, a unitless ratio of image height to object height.
di: image distance, same as above.
d0: object distance, same as above.
A positive dᵢ means a real image on the opposite side from the object (for a lens) or the same side (for a mirror); a negative dᵢ means a virtual image. The sign of m tells you orientation: positive means upright, negative means inverted, and |m| > 1 means the image is magnified.
Worked Example: A Simple Magnifying Setup
Using the calculator's defaults — a converging lens with f = 10 cm and an object placed at d₀ = 25 cm — solving for image distance gives , so cm. Magnification comes out to , meaning the image is real (positive dᵢ), inverted (negative m), and reduced (|m| < 1) — exactly what you'd expect from a camera lens forming an image on a sensor placed beyond the focal length.
Lenses vs. Mirrors
Both obey the identical mathematical relationship, but the physical picture differs: a lens bends light by refraction as it passes through, while a mirror bends light by reflection off its surface. This calculator applies the same formula to both, since the sign conventions used here are set up so the equation itself doesn't need to change — only how you interpret which side is "real."
A Brief History of the Lens Equation
The mathematical treatment of image formation by lenses developed gradually through the 17th century, with contributions from Johannes Kepler's early work on optics and later refinement by others working on telescope and microscope design. The thin lens equation in its modern form became a standard tool of geometric optics by the 19th century, underpinning the design of cameras, telescopes, and eyeglasses well before anyone could simulate ray paths on a computer.
Common Lens & Mirror Mistakes
Mixing up the sign convention between lenses and mirrors is the most common error — the same numeric result can mean a real image for one and a virtual image for the other, depending on which convention is in use, so it's important to stay consistent with a single convention throughout a problem. Forgetting that magnification's sign carries meaning (not just its magnitude) is another frequent slip, since a negative magnification indicating an inverted image is easy to overlook. Assuming an object exactly at the focal length produces a normal image is a third common mistake — at d₀ = f, the equation gives an infinite image distance, meaning parallel rays that never converge to form an image at all.
Optics Terms You Should Know
Focal Length (f) — the distance from a lens or mirror to its focal point, where parallel rays converge.
Real Image — an image formed where light rays actually converge, projectable onto a screen.
Virtual Image — an image formed where light rays only appear to originate, not projectable onto a screen.
Magnification (m) — the ratio of image height to object height, with sign indicating orientation.
This calculator uses the thin-lens/mirror approximation and a single sign convention; always double-check which convention your textbook or course uses before comparing answers.
Frequently Asked Questions
What's the difference between a real and a virtual image?
A real image forms where light rays actually converge and cross, and can be projected onto a screen — this happens when the image distance comes out positive. A virtual image forms where light rays only appear to come from when traced backward, like the enlarged image you see looking through a magnifying glass close up; it can't be projected onto a screen because no light actually passes through that point.
Why do I need different sign conventions for lenses and mirrors?
Both follow the exact same equation, 1/f = 1/do + 1/di, but the physical meaning of a positive or negative value differs because light passes through a lens but bounces off a mirror. This calculator uses the common convention where a converging lens or concave mirror has positive focal length, and a diverging lens or convex mirror has negative focal length — switch the mode above and the image-type interpretation adjusts automatically.
Why does my image distance come out negative?
A negative image distance means the image is virtual, forming on the same side as the object rather than the opposite side. This happens whenever the object sits closer to the lens or mirror than the focal length — a classic example is a magnifying glass held close to what you're looking at, which produces an enlarged, upright, virtual image.