🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
PHYSICS

Thin Lens Equation Calculator — image, size and type

Solve 1/f = 1/do + 1/di for whichever term you are missing, and read the magnification, the image height and whether the image is real or virtual.

The other two become the inputs. Signs follow the convention set out below, and virtual images come back as negative distances rather than as errors.
Positive for a converging (convex) lens, negative for a diverging (concave) one.
Measured from the lens to the object, positive for a real object on the incoming side.
Positive on the far side of the lens, which means a real image. Negative means a virtual image on the same side as the object.
All three distances share the same unit, and the image height is reported in it too. The equation itself is unit-agnostic as long as they match.
Image distance
 
 
0
Magnification
0
Image height
0
Image type
0
Object distance in focal lengths
Tip: a negative image distance is not an error. It means the image is virtual, formed on the same side of the lens as the object, and it can be seen by looking through the lens but cannot be projected onto a screen.
Advertisement

The thin lens equation calculator above solves 1/f = 1/do + 1/di for any one of the three terms and then reports what the result actually means physically. It gives the magnification, the height of the image, whether that image is upright or inverted, and whether it is real or virtual. Those descriptive results matter as much as the number, because a bare image distance of −75 tells you almost nothing until you know that the minus sign is the lens saying the image cannot be projected.

Arb Digital builds free tools that treat a negative result as an answer rather than a fault. Many lens calculators return an error or silently take an absolute value when the geometry produces a virtual image, which is the single most common case in everyday optics — every magnifying glass, every spectacle lens for short sight and every viewfinder works that way. This one states its sign convention on the page, applies it consistently and describes what came out.

What This Thin Lens Calculator Does

It models an idealised thin lens: one thin enough that the distance light travels inside the glass can be ignored, with all refraction treated as happening at a single plane. OpenStax University Physics Volume 3, section 2.4 on thin lenses, gives the equation as 1/do + 1/di = 1/f and the magnification as m = hi/ho = −di/do, with image distance positive when the image is on the opposite side from the object and negative when it is on the same side, and focal length positive for a converging lens and negative for a diverging one.

Those are exactly the conventions used here, stated plainly so there is no ambiguity: do is positive for a real object in front of the lens, di is positive for a real image behind it, f is positive for a converging lens, and the magnification carries a minus sign so that a negative m means an inverted image. Other textbooks use different conventions, and a result copied between two systems without checking is a reliable way to get the geometry backwards.

The fourth grid item, the object distance expressed in focal lengths, is there because it predicts the whole character of the image at a glance. Beyond two focal lengths the image is real, inverted and smaller. Between one and two, real, inverted and larger. Inside one focal length, virtual, upright and larger. That single ratio tells you which of those three regimes you are in before you read any other number.

How to Use It

  1. Choose the unknown. The hero renames itself and the tool reads only the two fields it needs, so a stale value in the third cannot affect the answer.
  2. Set the focal length sign correctly. Converging lenses are positive, diverging lenses negative. Getting this wrong inverts the entire result.
  3. Keep every distance in one unit. The equation is scale-free, so millimetres throughout is as valid as metres throughout, but mixing them is not.
  4. Enter an object height for the size. The image height is the object height multiplied by the magnification, so a negative result simply means inverted.
  5. Read the image type before the number. Real images can be projected onto a screen or sensor; virtual images can only be looked at through the lens.

The Formula: How the Thin Lens Equation Is Calculated

Rearranged for each unknown, the equation gives di = 1 ÷ (1/f − 1/do), do = 1 ÷ (1/f − 1/di) and f = 1 ÷ (1/do + 1/di). Magnification is m = −di ÷ do, and image height is hi = m × ho. Every reciprocal and every division is guarded, so a zero input returns a message instead of an infinity.

Work the defaults. A 50 mm converging lens with the object 75 mm away gives 1/di = 1/50 − 1/75 = 0.02 − 0.013333 = 0.006667, so di = 150 mm. The magnification is −150 ÷ 75 = −2, so a 10 mm object produces a 20 mm image, inverted. The image distance is positive, so the image is real and could be caught on a screen 150 mm behind the lens. The object sits at 1.5 focal lengths, which is the middle regime: real, inverted, magnified.

Now move the object inside the focal length. At 30 mm from the same lens, 1/di = 1/50 − 1/30 = −0.013333, giving di = −75 mm. The magnification is −(−75) ÷ 30 = +2.5, positive and therefore upright, and the image is virtual, 75 mm in front of the lens on the same side as the object. That is a magnifying glass, and the negative distance is the correct and meaningful answer rather than a failure.

Advertisement

Real and Virtual Images Are Both Real Answers

A real image is one where light actually converges and arrives. Put a screen, a piece of film or a sensor at that plane and a picture appears on it. That is what happens inside a camera, a projector and the human eye, and it is why real images are always the ones that can be captured.

A virtual image is a point from which the emerging light merely appears to diverge. No light passes through that location, so no screen will catch anything there, but your eye can focus on it perfectly well because diverging rays are what an eye expects. Magnifying glasses, spectacle lenses for short sight, camera viewfinders and the eyepiece of a telescope all produce virtual images, and they are entirely usable.

The mathematical marker is the sign of di. Positive is real and on the far side; negative is virtual and on the near side. A calculator that refuses negative results, or quietly reports the magnitude, hides the most informative part of the answer. For a converging lens the switch happens exactly at one focal length, which is why the object-distance-in-focal-lengths figure is worth watching.

What Happens Exactly at the Focal Point

Place the object at precisely one focal length and the arithmetic breaks down honestly: 1/f − 1/do is exactly zero, and the reciprocal of zero has no finite value. The physics is not broken, though. Rays from that object emerge from the lens perfectly parallel, so they never converge and no image forms at any finite distance. The conventional statement is that the image is at infinity, and the tool says so rather than displaying an infinity symbol or a wildly large number.

This is not an exotic edge case. It is the operating principle of a collimator, and it is how a spotlight or a lighthouse produces a beam that stays narrow. It is also the reason a magnifying glass gets dramatically less useful as you push it out towards its focal length: the magnification climbs towards impossible values and then flips sign as the image races off to infinity and comes back on the other side.

Very near the focal point, small errors in object distance produce enormous swings in image distance. A 50 mm lens with the object at 51 mm gives an image at 2,550 mm; at 50.5 mm it moves out to 5,050 mm. Any real optical system operating in that region is extremely sensitive to positioning, and the calculator will show the numbers exploding, which is exactly the warning you want.

Why a Camera Barely Moves Its Lens

Run the camera preset and the practical consequence of the equation appears. With a 5 mm lens and a subject 5,000 mm away, the image forms at 5.005 mm — five microns behind the focal plane. Bring the subject in to 500 mm and the image moves to 5.051 mm. The entire focusing range from half a metre to infinity is about fifty microns of travel.

That is precisely the point OpenStax makes in section 2.6 on the camera, explaining why a phone camera with a very short focal length can keep both a selfie at about half a metre and a group at five metres acceptably sharp on a fixed sensor. Longer lenses have no such luxury: a 200 mm lens focusing from infinity down to two metres has to move more than twenty millimetres, which is why long lenses have large focusing mechanisms and short ones often have none.

The same arithmetic explains macro photography. To get a magnification of 1:1 the object must sit at exactly two focal lengths, putting the image at two focal lengths on the other side, so the lens has to be a whole focal length further from the sensor than its infinity position. That extension is why dedicated macro lenses are physically long and why extension tubes work at all. If depth of field is the next question, the depth of field calculator takes over from here.

Where the Thin Lens Model Stops Being True

The equation assumes a lens of negligible thickness, rays close to the axis, a single wavelength and a perfectly spherical surface. Real optics violate all four. Thick lenses need principal planes, and the distances are then measured from those rather than from the glass. Rays far from the axis focus at a different distance, which is spherical aberration. Different wavelengths have different focal lengths, which is chromatic aberration and the reason good lenses combine several glass types.

Compound lenses are the bigger practical gap. A camera lens marked 50 mm contains many elements, and its effective focal length is a property of the whole assembly, not of any one piece of glass. The thin lens equation still describes the assembly's behaviour reasonably well from the outside, which is why the camera numbers above work, but the distances are measured from principal planes that may not sit anywhere near the physical middle of the barrel. For the refraction that underlies all of this, the Snell's law calculator handles the bending at a single surface.

Need a website that loads fast and actually works?

Arb Digital builds free tools like this one because useful pages earn attention. If you want tools, calculators or content built for your own audience, we can help.

Browse All Free Tools Talk to Arb Digital

Common Mistakes to Avoid

  • Treating a negative image distance as an error — it means a virtual image on the object's side, which is how magnifiers and viewfinders work.
  • Giving a diverging lens a positive focal length — concave lenses are negative, and the sign flip changes every conclusion that follows.
  • Mixing units between the three distances — the equation is scale-free but not unit-tolerant, so millimetres and metres cannot appear in the same calculation.
  • Adding focal lengths instead of reciprocals — the equation works in reciprocals, which is why optical power in dioptres adds so conveniently and focal lengths do not.
  • Using it near the focal point without care — image distance changes enormously for tiny changes in object distance there, and the sensitivity is real rather than a numerical artefact.

Related Free Tools From Arb Digital

For the refraction that produces the focusing in the first place, use the Snell's law calculator. Photographers will want the depth of field calculator for what stays sharp either side of the focused plane. For light itself, try the wavelength calculator and the photon energy calculator, and for illumination levels the lumen to lux calculator. Rescale distances with the length converter or angles with the angle converter, and browse the full free online tools hub for everything else.

Frequently Asked Questions

What sign convention does this calculator use?

Object distance is positive for a real object in front of the lens, image distance is positive for a real image behind it and negative for a virtual image in front, focal length is positive for a converging lens and negative for a diverging one, and magnification is minus the image distance divided by the object distance.

Why did I get a negative image distance?

Because the image is virtual. It sits on the same side of the lens as the object and cannot be projected onto a screen, but it can be seen by looking through the lens. This is the normal result whenever an object is inside the focal length of a converging lens.

What does a negative magnification mean?

The image is inverted relative to the object. A positive magnification means it is upright. The absolute value gives the size ratio, so a magnification of minus two is an image twice as tall and upside down.

What happens when the object sits exactly at the focal point?

Rays emerge from the lens parallel, so they never converge and no image forms at any finite distance. The conventional description is an image at infinity, and the calculator says so rather than returning a meaningless enormous number.

Can a diverging lens ever produce a real image?

Not from a real object. A negative focal length always yields a negative image distance for a positive object distance, so the image is always virtual, upright and smaller. Real images from diverging elements only arise inside compound systems where the incoming light is already converging.

Do the distances have to be in millimetres?

No. The equation is scale-free, so any unit works as long as all three distances use the same one. The unit selector is simply there to label the output, and the image height comes back in whatever you chose.

Why does a camera lens move so little when focusing?

Because image distance changes very slowly once the object is many focal lengths away. A short lens focusing from half a metre to infinity moves only tens of microns, which is why phone cameras can manage with a fixed sensor position while long lenses need substantial travel.

Does this work for a thick or compound lens?

Approximately. The model assumes negligible thickness and rays close to the axis. A thick or multi-element lens behaves similarly from the outside, but the distances must then be measured from its principal planes rather than from the physical glass.

This tool is provided for educational and estimating use. It models an idealised thin lens with paraxial rays and a single wavelength, and does not account for lens thickness, aberrations, aperture effects or multi-element designs, so treat its output as a physics result rather than an optical design specification.

Advertisement
Advertisement

Take it further