Thin Lens Equation Calculator
Solve the thin lens equation 1/f = 1/do + 1/di for image distance, object distance or focal length. Enter any two known values and get the third, plus image type, magnification and image height.
Find the Missing Distance or Focal Length
Lens Equation Formula
Where:
- \(f\) — focal length of the lens (m)
- \(d_o\) — object distance: from the object to the lens (m)
- \(d_i\) — image distance: from the lens to the image (m)
Solving for the missing quantity gives three equivalent rearrangements: \(d_i = \dfrac{d_o f}{d_o - f}\), \(d_o = \dfrac{d_i f}{d_i - f}\) and \(f = \dfrac{d_o d_i}{d_o + d_i}\). Once all three distances are known, the lateral magnification follows from \(m = -\dfrac{d_i}{d_o}\), and the image height from \(h_i = m\,h_o\).
Lens Equation – Calculation Example
Example: an object stands 30 cm in front of a converging lens with a focal length of 10 cm, and the object is 5 cm tall. Where does the image form, and what is it like?
\[ d_i = \frac{d_o f}{d_o - f} = \frac{0.30 \times 0.10}{0.30 - 0.10} = \frac{0.03}{0.20} = 0.15\ \text{m} \]
\[ m = -\frac{d_i}{d_o} = -\frac{0.15}{0.30} = -0.5 \]
\[ h_i = m\,h_o = -0.5 \times 0.05 = -0.025\ \text{m} \]
Result: the image forms 15 cm behind the lens (real, since \(d_i > 0\)). The magnification is \(-0.5\times\), so the image is inverted and half the size of the object: 2.5 cm tall.
How to use the calculator
- In the Solve for dropdown, choose the quantity you want to calculate: Image distance (di), Object distance (do) or Focal length (f). The field for that quantity is hidden — you enter the other two.
- Enter the two known distances in Object distance (do) and Focal length (f) (or Image distance (di) when solving for do), and pick the unit (mm, cm, m, in or ft) for each.
- Optionally enter the Object height (ho) if you also want the image height. Leave it empty to skip that part.
- Read the results: the solved distance (converted into metres, centimetres, millimetres, inches and feet), the lens type, whether the image is real or virtual, and the magnification, orientation and image height.
What the thin lens equation describes
The thin lens equation links the position of an object, the position of its image, and the focal length of a lens. A lens bends parallel rays so that they either converge to a point (a converging, or convex, lens with \(f > 0\)) or appear to diverge from one (a diverging, or concave, lens with \(f < 0\)). The focal length is the distance from the lens to that point, and it fully determines how the lens images objects — as long as the lens is thin compared with the distances involved.
The sign convention matters. A real object in front of the lens has \(d_o > 0\). A positive image distance means a real image: the light actually converges on the far side of the lens, so you can catch it on a screen or sensor — this is how cameras and projectors work. A negative image distance means a virtual image: the rays only appear to come from a point on the object's side of the lens, so you must look through the lens to see it, as with a magnifying glass or eyeglasses.
The magnification \(m = -d_i/d_o\) tells you how the image compares with the object. Its absolute value is the size ratio: \(|m| = 2\) means the image is twice as tall. The sign gives the orientation: a negative \(m\) means the image is inverted (upside down), a positive \(m\) means upright. Real images formed by a single converging lens are inverted; virtual ones are upright.
Two special cases are worth remembering. If the object sits exactly at the focal point (\(d_o = f\)), the image forms at infinity — this is the setting of a searchlight or collimator. If the object is very far away (\(d_o \to \infty\)), then \(d_i = f\): parallel incoming rays focus at the focal point, which is how a camera focuses a distant scene onto the sensor.
Sign conventions at a glance
| Quantity | Positive | Negative |
|---|---|---|
| Focal length \(f\) | Converging (convex) lens | Diverging (concave) lens |
| Object distance \(d_o\) | Real object in front of the lens | Virtual object (rare, e.g. in lens systems) |
| Image distance \(d_i\) | Real image behind the lens (projectable) | Virtual image on the object's side |
| Magnification \(m\) | Upright image | Inverted image |
Assumptions and limitations
- Thin lens: the lens thickness is assumed negligible compared with \(d_o\), \(d_i\) and \(f\). For thick lenses or lens systems, measured distances from principal planes give small corrections.
- Paraxial rays: the equation holds for rays close to the optical axis and at small angles. Wide-aperture lenses suffer from aberrations that shift the true focus.
- Single wavelength: the focal length depends slightly on the colour of the light (chromatic aberration), so the result is exact only for one wavelength.
- The calculator assumes the standard sign convention above. If your textbook uses a different convention, convert the signs before comparing results.
- Distances must be nonzero, and the degenerate cases (\(d_o = f\), \(d_i = f\), or \(d_o = -d_i\)) correspond to images or objects at infinity and are rejected with an explanation.
Related calculators
For more physics tools, try the Kinematic Equations Solver for motion problems, the Displacement Calculator for position changes, or the Power Calculator for energy transfer over time.
Frequently Asked Questions
How do I solve the thin lens equation by hand?
Start from \( 1/f = 1/d_o + 1/d_i \) and solve for the unknown. For the image distance: \( d_i = \frac{d_o f}{d_o - f} \). For the focal length: \( f = \frac{d_o d_i}{d_o + d_i} \). Use the calculator to check your arithmetic — it also applies the sign convention for you, which is where hand calculations most often go wrong.
Why is my image distance negative — is that an error?
No, a negative \( d_i \) means the image is virtual. It forms on the same side of the lens as the object, so you cannot project it onto a screen — you only see it by looking through the lens. This happens whenever the object is closer to a converging lens than its focal point, which is exactly how a magnifying glass works. The image is then upright and enlarged.
Does the thin lens equation work for concave (diverging) lenses?
Yes, but enter the focal length as a negative number. For a diverging lens, \( f < 0 \), and a real object always produces a virtual, upright, reduced image on the object's side. This is why eyeglasses for nearsightedness use negative lenses. If you enter a positive focal length for a concave lens, every result will come out wrong.
How do I convert focal length to lens power in diopters?
Optical power is the reciprocal of the focal length in metres: \( P = 1/f \), measured in diopters (D). A lens with \( f = 0.25 \) m has \( P = 4 \) D; a diverging lens with \( f = -0.5 \) m has \( P = -2 \) D. Prescription eyewear is specified in diopters, while camera lenses usually quote focal length in millimetres — this conversion bridges the two.
Can I use this equation for mirrors too?
Yes. The same equation applies to spherical mirrors with the same sign convention: a concave mirror behaves like a converging lens (positive \( f \)), and a convex mirror like a diverging one (negative \( f \)). The mirror focal length equals half its radius of curvature, \( f = R/2 \). The main physical difference is that a mirror forms real images on the same side as the object.
What happens if the object is exactly at the focal point?
The equation breaks down: with \( d_o = f \) the refracted rays leave the lens parallel and never converge, so the image forms at infinity. This is not an error in your setup — it is a genuine degenerate case, used deliberately in searchlights and collimators to produce a parallel beam. The calculator detects it and explains it rather than returning an infinite value.
What are the most common mistakes with this equation?
The top three: forgetting the sign of a negative focal length or image distance, mixing units (entering centimetres where metres are expected, or vice versa), and confusing object distance with image distance. Also remember the equation assumes a thin lens and small angles — a thick lens or a wide-aperture system deviates slightly, and measured results may differ by a few percent.