Saved

Press the star next to a tool's name to save it.

All my tools

Lens Calculator

This lens calculator solves the thin lens equation. Enter any two of focal length, object distance and image distance and it finds the third, then gives the magnification and tells you whether the image is real or virtual.

Restored your last values ·

Fill in exactly two of the three boxes and leave the third blank. Use one length unit for all of them. A converging lens has a positive focal length and a diverging lens a negative one.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Fill in two of the three boxes to solve for the third.

See full result

What this lens calculator does

This lens calculator uses the Gaussian thin lens equation, which links the focal length f, the object distance and the image distance by 1/f = 1/do + 1/di. [1] You give any two of the three and it solves for the missing one. It then works out the magnification and says whether the image is real or virtual, upright or inverted, larger or smaller.

How to use the lens calculator

  1. Pick which quantity you want to find and leave that box blank.
  2. Fill in the other two boxes, using the same unit for both, for example centimetres.
  3. Press Calculate to see the three distances, the magnification and the image type.

You must fill in exactly two boxes. With one box or three boxes filled, the calculator asks you to try again, because the equation has one unknown.

Sign convention

The Wikipedia article gives the usual signs. The object distance is positive for a real object and negative for a virtual one. The image distance is positive for a real image and negative for a virtual one. The focal length is positive for a converging lens and negative for a diverging lens. [1] The calculator follows these signs, so a negative answer for the image distance means a virtual image on the same side of the lens as the object.

Formulas used

  • Focal length: f = (do × di) / (do + di).
  • Image distance: di = 1 / (1/f − 1/do).
  • Object distance: do = 1 / (1/f − 1/di).
  • Magnification: M = −di / do.

The article defines the transverse magnification as the ratio of the image height to the object height. [1] The form M = −di/do follows from similar triangles and is the common textbook version, so treat it as our own working. A negative value means the image is inverted compared with the object.

Worked example

A converging lens has a focal length of 10 cm. An object stands 30 cm in front of it.

StepWorkingResult
1/f1 / 100.1
1/do1 / 300.03333
1/di0.1 − 0.033330.06667
Image distance1 / 0.0666715 cm
Magnification−15 / 30−0.5

The image forms 15 cm behind the lens. The magnification of −0.5 means the image is half the size of the object and upside down. Because the image distance is positive, it is a real image that you could catch on a screen.

Now try the reverse. With do = 20 and di = 20, the focal length is 10. This is the case where the object sits at twice the focal length and the image forms at the same distance on the other side, at the same size but inverted.

What the results mean

  • Object beyond 2f: the image is real, inverted and smaller.
  • Object between f and 2f: the image is real, inverted and larger.
  • Object at f: the rays leave parallel and no image forms. The calculator reports that the numbers give no result.
  • Object inside f for a converging lens: the image is virtual, upright and larger, which is how a magnifying glass works.
  • Diverging lens: the image is always virtual, upright and smaller.

Limits of the thin lens equation

The equation is an idealisation. It treats the lens as having no thickness and assumes light rays make small angles with the axis. Thick lenses, wide-angle rays and lens defects called aberrations all cause real images to differ from the prediction. For camera lenses made of many elements, the quoted focal length is an effective value and distances are measured from the principal planes, not from the front of the glass.

Common mistakes

  • Using different units for the boxes. Keep them all in the same unit.
  • Dropping the minus sign on a diverging lens focal length.
  • Entering all three values. Leave exactly one blank.
  • Measuring distance from the lens barrel or camera body instead of from the lens centre.
  • Reading a negative image distance as an error. It means the image is virtual.

Using the lens calculator for cameras and projectors

The same equation covers a camera, a projector and a magnifying glass. In a camera, the subject is the object and the sensor sits at the image distance. For a distant subject, the image distance is almost exactly the focal length, which is why a camera lens focuses by moving only a small amount. For close-up work, the lens must move further from the sensor, and the image gets bigger.

In a slide or video projector the roles swap. The slide sits just beyond the focal length and the sharp image forms far away on the screen, with a large magnification. Enter the focal length and the screen distance to find how far the slide must sit from the lens.

A second worked example

A magnifying glass has a focal length of 10 cm and you hold it 6 cm from a stamp. Enter f = 10 and the object distance as 6. The image distance comes out at −15 cm. The negative sign means a virtual image on the same side as the stamp. The magnification is −(−15) ÷ 6 = 2.5, so the stamp looks 2.5 times larger and upright.

Compare this with the first example where the object was outside the focal length. Moving the object inside the focal length flips the image from real and inverted to virtual and upright, which is why a magnifier only works when held close to the object.

What next

Use this often? Add Lens to your Home screen.

Frequently asked questions

What is the thin lens equation?

It is 1/f = 1/do + 1/di, where f is the focal length, do is the object distance and di is the image distance.

How do I use this lens calculator to find the focal length?

Enter the object distance and the image distance and leave the focal length blank. For example, 20 and 20 give a focal length of 10.

What does a negative magnification mean?

The image is inverted. A positive magnification means an upright image.

Why do I get an error when the object is at the focal length?

At that position the rays leave the lens parallel, so no image forms at a finite distance and the equation has no solution.

What is a virtual image?

A virtual image has a negative image distance. It appears on the same side of the lens as the object and cannot be projected on a screen.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Physics & Science Tools