Thin Lens Equation Calculator

Solve thin lens problems by finding the missing value (f, do, di, or magnification) and getting a plain-language image description (real/virtual, upright/inverted, magnified/reduced). Choose beginner-friendly positive distances or enter signed values if your class uses a sign convention.

Advanced options
Extra inputs
Manual signed convention (info)
This dropdown is informational so you can match your textbook wording.
Number display
Did we solve your problem today?

How to use our Thin Lens Equation Calculator

  1. Choose Solve for (the calculator hides the value you are solving for).
  2. Choose Input mode: use Lens type + positive distances if you want to enter normal positive distances, or choose the manual signed option if your homework requires + and - signs.
  3. Pick a Distance unit (mm, cm, or m). Use that same unit for every distance and height you enter.
  4. If you are in Lens type mode, choose Lens type (only for Lens type mode), then enter Focal length f (selected unit) as a positive magnitude.
  5. Enter Object distance do (selected unit). (In manual signed mode, do is usually positive for a real object.)
  6. If you are not solving for it, open Advanced options and enter Image distance di (selected unit). In manual signed mode, di > 0 means a real image and di < 0 means a virtual image.
  7. Optional: Enter Object height ho (selected unit) to compute Image height hi (selected unit). Expect hi to be negative when the image is inverted.
  8. Optional: In Advanced options, set Number display format if you want to force Plain numbers or Scientific notation.
  9. Click Calculate.
  10. Sanity-check: look at Equation check (1/f and 1/do + 1/di). The two sides should match closely (small differences are just rounding). If they do not, re-check units, which value you solved for, and whether you used the right sign mode.

Common mistakes and quick fixes

Mistake: Mixing units (for example, f in cm but do in mm).

Fix: Pick one Distance unit and enter all distances and heights in that same unit.

Mistake: Typing negative values while still in Lens type + positive distances mode.

Fix: If you want to enter a negative f or di, switch Input mode to the manual signed option first.

Mistake: Solving for di when Object distance do (selected unit) equals Focal length f (selected unit).

Fix: Change do so it is not equal to f. At do = f, the model says the image is at infinity, so di is undefined and the calculator will show N/A with a warning.

Mistake: Using only Magnification magnitude |m| and ignoring the sign of Magnification m (signed).

Fix: Use signed m for orientation (m > 0 upright, m < 0 inverted). Use |m| only to tell how much bigger or smaller the image is.

Mistake: Being surprised when Image height hi (selected unit) is negative after entering a positive Object height ho (selected unit).

Fix: Negative hi is expected for an inverted image because hi = m times ho. Check the sign of Magnification m (signed).

Mistake: Leaving a needed field blank for your chosen Solve for option (for example, di is blank when you are solving for f).

Fix: Enter the hidden-needed value in Advanced options (or change Solve for to match what you actually know).


Definitions

Thin lens equation: A relationship for a thin lens that connects focal length, object distance, and image distance. In one common form: 1/f = 1/do + 1/di. [1]

Focal length f: How strongly a lens bends light. With the sign convention used in many textbooks, converging (convex) lenses have f > 0 and diverging (concave) lenses have f < 0. [1]

Object distance do: The distance from the lens to the object. In the manual signed convention used here, a real object is usually do > 0. [4]

Image distance di: The distance from the lens to the image location. In the manual signed convention used here, di > 0 means a real image (on the opposite side of the lens from the object) and di < 0 means a virtual image (on the same side as the object). [4]

Magnification m (signed): How the image size and orientation compare to the object, computed as m = -di/do. m > 0 is upright, m < 0 is inverted. [1]

Image height hi: The image height computed from hi = m times ho when you enter an object height ho. A negative hi means the image is inverted relative to a positive ho. [1]


Methodology

Sign convention options (what the calculator means by + and -): You can use either mode. In Lens type + positive distances mode, you enter positive magnitudes for f, do, and di, then the calculator assigns f > 0 for a converging lens and f < 0 for a diverging lens; do is treated as positive. In manual signed mode, you enter signed values using a common convention: f > 0 converging, f < 0 diverging; do > 0 for a real object; di > 0 for a real image and di < 0 for a virtual image. [1] [4]

Core equations used:

1/f = 1/do + 1/di

di = 1 / (1/f - 1/do)

do = 1 / (1/f - 1/di)

f = 1 / (1/do + 1/di)

m = -di/do

hi = m * ho

These relationships are standard for thin lenses in intro optics. [1] [2]

How outputs are interpreted: Real vs virtual comes from the sign of di (in manual signed mode): di > 0 real, di < 0 virtual. Upright vs inverted comes from the sign of m: m > 0 upright, m < 0 inverted. Magnified vs reduced comes from |m|: |m| > 1 larger, |m| < 1 smaller. The calculator keeps m signed (it does not force an absolute value) so you do not lose the orientation info. [1]

Equation check output: The tool also calculates both sides of the thin lens equation as values in 1 per selected unit: left side is 1/f and right side is 1/do + 1/di. If they are far apart, it usually means a wrong sign mode, a missing required input, or a rounding-heavy value was typed.

Worked mini-example (cm): Converging lens, f = 10 cm and do = 25 cm. Solve for di.

di = 1 / (1/10 - 1/25) = 1 / (0.1 - 0.04) = 1 / 0.06 = 16.6667 cm

m = -di/do = -16.6667/25 = -0.6667

Interpretation: di is positive so the image is real. m is negative so the image is inverted. |m| is about 0.667, so the image is smaller than the object. [1]

Assumptions and limits: This is the thin lens, paraxial (small-angle) model, so real lenses can differ due to thickness, aberrations, and large angles. Special case: when solving for di, if do equals f then (1/f - 1/do) becomes 0 and the equation predicts an image at infinity; the calculator reports N/A and shows a warning. [1]


Sources