Physics · Optics · Optics & Light
Lens Equation Calculator
Calculates image distance, object distance, or focal length using the thin lens equation, along with magnification and image characteristics.
Calculator
Formula
f is the focal length of the lens (positive for converging, negative for diverging); d_o is the object distance from the lens (positive when object is on the incoming light side); d_i is the image distance from the lens (positive for a real image on the far side, negative for a virtual image); m is the lateral magnification (negative m means the image is inverted, |m| > 1 means magnified).
Source: Hecht, E. (2017). Optics, 5th Edition. Pearson. Chapter 5: Geometrical Optics.
How it works
The thin lens equation is one of the cornerstones of geometric optics. It describes how a single refracting lens maps an object at a given distance to a corresponding image point. The equation assumes the lens is thin — meaning its thickness is negligible compared to the object and image distances — and that paraxial rays (rays close to and nearly parallel with the optical axis) are being considered. Under these conditions, the geometry of refraction reduces to a beautifully simple reciprocal relationship between three distances: the focal length, the object distance, and the image distance.
The formula is expressed as 1/f = 1/d₀ + 1/dᵢ, where f is the focal length of the lens, d₀ is the distance from the object to the lens, and dᵢ is the distance from the lens to the image. Sign conventions follow the standard Cartesian system: distances are measured from the lens, with values in the direction of the outgoing light taken as positive. For a converging (convex) lens, f is positive; for a diverging (concave) lens, f is negative. A positive dᵢ indicates a real image formed on the far side of the lens, while a negative dᵢ indicates a virtual image on the same side as the object. Lateral magnification m = −dᵢ/d₀ tells you both the size ratio and orientation: a negative m means the image is inverted, and |m| > 1 means the image is larger than the object.
Practical applications are vast. Camera designers use the lens equation to calculate where a sensor must be placed for a given subject distance. Microscope builders use it to design multi-element systems with precise magnifications. Optometrists use the concept to prescribe corrective lenses. Telescope makers rely on it to position eyepieces for collimated exit beams. Even in everyday photography, understanding that moving a subject closer to a macro lens requires the sensor to be moved farther back is a direct consequence of this equation.
Worked example
Problem: A converging lens has a focal length of 10 cm. An object is placed 30 cm in front of the lens. Where does the image form, and what is the magnification?
Step 1 — Write the thin lens equation:
1/f = 1/d₀ + 1/dᵢ
1/10 = 1/30 + 1/dᵢ
Step 2 — Isolate 1/dᵢ:
1/dᵢ = 1/10 − 1/30 = 3/30 − 1/30 = 2/30 = 1/15
Step 3 — Solve for dᵢ:
dᵢ = 15 cm
The positive value confirms the image is real and forms on the opposite side of the lens from the object.
Step 4 — Calculate magnification:
m = −dᵢ/d₀ = −15/30 = −0.5
The magnification of −0.5 tells us the image is inverted (negative sign) and is half the size of the object (|m| = 0.5). This is consistent with the object being at three times the focal length, which produces a reduced real image between f and 2f on the image side.
Limitations & notes
The thin lens equation is derived under the paraxial approximation, meaning it is strictly valid only for rays that travel close to the optical axis and make small angles with it. For wide-angle systems or large-aperture lenses, real aberrations — including spherical aberration, coma, and astigmatism — cause the actual image position and sharpness to deviate from the theoretical prediction. Additionally, the formula treats the lens as having zero thickness; for thick lenses or multi-element systems, the principal planes must be accounted for, and the simple thin lens formula no longer applies directly without modification. The equation also breaks down when d₀ equals f (the object is at the focal point), producing an image at infinity — physically this means parallel rays emerge and no real image is formed at a finite distance. Extreme care must be taken with sign conventions: mixing up the Cartesian and the real-is-positive conventions is a common source of error. Finally, this calculator does not account for lens aberrations, coatings, transmission losses, or the wavelength-dependence of focal length (chromatic aberration), all of which matter in precision optical design.
Frequently asked questions
What is the thin lens equation and when does it apply?
The thin lens equation, 1/f = 1/d₀ + 1/dᵢ, applies to a lens whose thickness is negligible compared to the object and image distances. It is valid in the paraxial regime — when light rays make small angles with the optical axis — and provides accurate results for most everyday optical systems such as camera lenses, magnifying glasses, and simple telescopes.
What does a negative image distance mean?
A negative image distance (dᵢ < 0) means the image is virtual — it forms on the same side of the lens as the incoming object, rather than on the far side. Virtual images cannot be projected onto a screen; they are seen by looking through the lens, as with a magnifying glass used close to an object or any diverging lens.
What is the difference between a converging and a diverging lens?
A converging (convex) lens has a positive focal length and bends parallel rays toward a single focal point on the far side. A diverging (concave) lens has a negative focal length and spreads parallel rays apart so they appear to originate from a virtual focal point on the incoming side. Converging lenses can form both real and virtual images depending on object placement, while diverging lenses always form virtual, upright, and reduced images.
How does magnification relate to image orientation?
Lateral magnification m = −dᵢ/d₀. If m is negative, the image is inverted relative to the object; if m is positive, the image is upright. The absolute value |m| gives the size ratio: values greater than 1 mean the image is magnified, values less than 1 mean it is reduced, and m = 1 means the image is the same size as the object.
Can I use this calculator for mirrors as well as lenses?
Spherical mirrors follow an identical mathematical formula, the mirror equation, which has the same form as the thin lens equation. However, the sign conventions differ slightly: for mirrors, a positive dᵢ means the image is in front of the mirror (real), while a negative dᵢ means it is behind the mirror (virtual). This calculator uses the lens sign convention, so for mirror problems you should interpret the results accordingly or use a dedicated mirror equation calculator.
Last updated: 2025-01-15 · Formula verified against primary sources.