Thin lens equation calculator
Solve for image distance, object distance or focal length, with magnification, image type and lens power.
A clear answer. Here’s how.
Uses the thin-lens equation 1/f = 1/do + 1/di with the real-is-positive sign convention: f is positive for a converging (convex) lens and negative for a diverging one, do is positive for an object in front of the lens, and di is positive for a real image behind the lens and negative for a virtual image on the object’s side. Magnification m = −di/do, so a negative m means an inverted image, and image height = m × object height. Lens power in dioptres is 1 ÷ f with f in metres. If the object sits exactly at the focal point, the image is at infinity. Valid for paraxial rays and thin lenses in air.
How this is checked
5 reference checks passed These 5 cases were run when this page was built, on 20 October 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Solve for imageUnit for distances cmFocal length (positive converging, negative diverging) 10Object distance (positive, in front of the lens) 30Object height (same unit) 2
- Expected, and what Toolmoz gave
- Image distance (cm) expected 15, Toolmoz 14.999999999999996Magnification expected -0.5, Toolmoz -0.4999999999999999Image height (cm) expected -1, Toolmoz -0.9999999999999998Image type expected Real, Toolmoz RealOrientation expected Inverted, Toolmoz InvertedLens power (dioptres) expected 10, Toolmoz 10
- Where the expected answer comes from
- 1/di = 1/10 − 1/30 = 2/30, so di = 15 cm; m = −15 ÷ 30 = −0.5; image height −0.5 × 2 = −1; power 1 ÷ 0.1 m = 10 D (hand calculation)
- Allowed difference
- ±1e-9
Case 2
- Inputs
- Solve for imageUnit for distances cmFocal length (positive converging, negative diverging) 10Object distance (positive, in front of the lens) 5Object height (same unit) 1
- Expected, and what Toolmoz gave
- Image distance (cm) expected -10, Toolmoz -10Magnification expected 2, Toolmoz 2Image type expected Virtual, Toolmoz VirtualOrientation expected Upright, Toolmoz UprightSize relative to the object expected Enlarged, Toolmoz Enlarged
- Where the expected answer comes from
- 1/di = 1/10 − 1/5 = −1/10, so di = −10 cm (virtual, a magnifying glass); m = 10 ÷ 5 = 2 (hand calculation)
- Allowed difference
- ±1e-9
Case 3
- Inputs
- Solve for imageUnit for distances cmFocal length (positive converging, negative diverging) -10Object distance (positive, in front of the lens) 20Object height (same unit) 1
- Expected, and what Toolmoz gave
- Image distance (cm) expected -6.6666667, Toolmoz -6.666666666666666Magnification expected 0.3333333, Toolmoz 0.3333333333333333Lens type expected Diverging (concave), Toolmoz Diverging (concave)
- Where the expected answer comes from
- 1/di = −1/10 − 1/20 = −3/20, so di = −6.6667 cm; m = 6.6667 ÷ 20 = 1/3 (hand calculation)
- Allowed difference
- ±0.000001
Case 4
- Inputs
- Solve for focalUnit for distances cmObject distance (positive, in front of the lens) 30Image distance (positive real, negative virtual) 15
- Expected, and what Toolmoz gave
- Focal length (cm) expected 10, Toolmoz 10
- Where the expected answer comes from
- 1/f = 1/30 + 1/15 = 3/30, so f = 10 cm (hand calculation)
- Allowed difference
- ±1e-9
Case 5
- Inputs
- Solve for objectUnit for distances cmFocal length (positive converging, negative diverging) 10Image distance (positive real, negative virtual) 15
- Expected, and what Toolmoz gave
- Object distance (cm) expected 30, Toolmoz 29.999999999999993
- Where the expected answer comes from
- 1/do = 1/10 − 1/15 = 1/30, so do = 30 cm (hand calculation)
- Allowed difference
- ±1e-9
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Solve for
- Image distance (given focal length and object distance)
- Unit for distances
- Centimetres
- Focal length (positive converging, negative diverging)
- 10
- Object distance (positive, in front of the lens)
- 30
- Image distance (positive real, negative virtual)
- 15
- Object height (same unit)
- 2
Example result
- Focal length (cm)
- 10
- Lens power (dioptres)
- 10
- Lens type
- Converging (convex)
- Object distance (cm)
- 30
- Image distance (cm)
- 15
- Image type
- Real
- Magnification
- -0.5
- Orientation
- Inverted
- Size relative to the object
- Reduced
- Image height (cm)
- -1
Thin-lens equation 1/f = 1/do + 1/di with real-is-positive signs: a positive image distance is a real image on the far side of the lens, a negative one is a virtual image on the object’s side. Valid for paraxial rays through a thin lens in air; thick lenses and aberrations are ignored. Use the same unit for every distance.