Science

Lens Equation Calculator

Solve the thin lens equation (1/f = 1/do + 1/di) for any unknown. Shows magnification, image type (real/virtual), orientation (upright/inverted), and relative size.

Key Formulas

1/f = 1/do + 1/di  |  M = -di/do  |  Power (diopters) = 1/f(m)

Calculate

Select what to solve for, then enter the two known values. Use negative values for diverging lenses or virtual images.

Focal Length
10 cm
Object Distance
30 cm
Image Distance
15 cm
Magnification
-0.5x
Image Type
Real
Orientation
Inverted
Size
Diminished

Quick Examples

About This Tool

The Lens Equation Calculator solves the thin lens equation (1/f = 1/do + 1/di) for any unknown variable given the other two. Beyond the basic calculation, it determines the magnification (M = -di/do) and characterizes the resulting image as real or virtual, upright or inverted, and enlarged or diminished. This makes it an indispensable tool for physics students studying optics, photographers understanding lens behavior, optometrists prescribing corrective lenses, and engineers designing optical instruments.

The Thin Lens Equation Explained

The thin lens equation 1/f = 1/do + 1/di is derived from geometric optics by tracing light rays through an idealized lens of negligible thickness. Here, f is the focal length (the distance from the lens to the point where parallel rays converge), do is the object distance (from the object to the lens), and di is the image distance (from the lens to where the image forms). This equation applies to both converging lenses (f > 0, also called convex lenses) and diverging lenses (f < 0, also called concave lenses). The sign convention is critical: positive image distances indicate real images on the far side of the lens, while negative values indicate virtual images on the same side as the object.

Understanding Magnification

The magnification M = -di/do tells you everything about how the image compares to the object. The absolute value |M| gives the size ratio: |M| = 2 means the image is twice as tall as the object. The sign indicates orientation: positive M means the image is upright (same orientation as the object), and negative M means inverted (flipped upside down). A magnifying glass held close to text produces M > 1 (enlarged and upright), because the object is inside the focal length, creating a virtual image. A projector lens creates a real, inverted, enlarged image (M < -1) on the screen, which is why projector slides must be inserted upside-down (or the optics include a correction).

Real vs. Virtual Images

A real image forms where light rays physically converge after passing through the lens. You can place a screen at that location and see the image projected on it. Cameras, projectors, and the human eye all form real images. A virtual image, by contrast, forms where light rays appear to diverge from but never actually pass through. You cannot project a virtual image onto a screen. The image you see in a flat mirror is virtual, as is the enlarged image through a magnifying glass when the object is closer than the focal length. Virtual images are seen by looking through the lens (or mirror), not by projecting onto a surface.

Converging vs. Diverging Lenses

Converging (convex) lenses are thicker in the middle than at the edges. They bend parallel light rays inward to a focal point and have positive focal lengths. They can produce both real and virtual images depending on the object placement. Diverging (concave) lenses are thinner in the middle and spread light rays apart. They have negative focal lengths and always produce virtual, upright, diminished images of real objects. Eyeglasses for nearsightedness (myopia) use diverging lenses, while reading glasses for farsightedness (hyperopia) use converging lenses. The strength of a lens is measured in diopters, defined as 1/f where f is in meters.

Applications in Photography

Every camera lens obeys the thin lens equation (or its thick-lens generalization). When you focus a camera, you are adjusting the lens-to-sensor distance (di) to match the object distance (do) for a given focal length (f). A 50mm lens focused on an object 2 meters away produces an image at approximately 51.3mm behind the lens. Zoom lenses change the effective focal length, altering both the magnification and field of view. Understanding the lens equation helps photographers predict depth of field, choose appropriate focal lengths, and understand why close-up photography requires significant lens extension (macro lenses).

Compound Lenses and Optical Instruments

Telescopes, microscopes, and other optical instruments combine multiple lenses. The image formed by the first lens (objective) serves as the object for the second lens (eyepiece). By cascading the thin lens equation, you can analyze the entire optical system. A compound microscope uses an objective lens to form a real, enlarged, inverted image inside the tube, and an eyepiece to further magnify that intermediate image. The total magnification is the product of the individual magnifications. Modern optical systems may contain dozens of lens elements to correct aberrations, but the fundamental thin lens equation remains the starting point for all optical design.

Frequently Asked Questions

What is the thin lens equation?
The thin lens equation relates the focal length (f) of a lens to the object distance (do) and image distance (di): 1/f = 1/do + 1/di. It applies to ideal thin lenses where the lens thickness is negligible compared to the focal length and object/image distances. The equation works for both converging (convex, f > 0) and diverging (concave, f < 0) lenses. It is one of the most important equations in optics, used to predict where an image will form and its properties (size, orientation, real vs. virtual).
What is the sign convention for lenses?
In the standard sign convention for thin lenses: object distances are positive when the object is on the incoming light side (real object). Image distances are positive when the image is on the opposite side from the object (real image) and negative when on the same side (virtual image). Focal length is positive for converging lenses and negative for diverging lenses. Magnification is positive for upright images and negative for inverted images. This sign convention is essential for correctly interpreting calculator results.
What is the difference between a real and virtual image?
A real image forms where light rays actually converge and can be projected onto a screen. It has a positive image distance (di > 0) in the standard sign convention. A virtual image forms where light rays appear to diverge from but do not actually pass through. It cannot be projected onto a screen and has a negative image distance (di < 0). You see virtual images when looking through a magnifying glass (object inside focal length) or in a flat mirror. Cameras and projectors use real images, while eyepieces and magnifiers often produce virtual images.
What does magnification tell you?
Magnification (M = -di/do) tells you how the image size compares to the object size. |M| > 1 means the image is enlarged (larger than the object). |M| < 1 means it is diminished (smaller). |M| = 1 means same size. The sign indicates orientation: positive M means upright (same orientation as the object) and negative M means inverted (flipped). A magnifying glass used properly gives M > 1 (enlarged) and positive (upright virtual image). A camera lens typically gives |M| << 1 (diminished) and negative (inverted real image on the sensor).
How does this apply to cameras and eyeglasses?
In a camera, the lens forms a real, inverted, diminished image on the sensor or film. The lens equation determines the sensor-to-lens distance needed for sharp focus at a given object distance. For eyeglasses, a nearsighted person has eyes that focus too strongly, so a diverging lens (negative f) is prescribed to push the focal point back onto the retina. A farsighted person needs a converging lens (positive f) to help the eye focus nearby objects. The optometrist measures the needed lens power in diopters, which is simply 1/f (in meters).
What are the limitations of the thin lens equation?
The thin lens equation assumes the lens is infinitely thin and all rays make small angles with the optical axis (paraxial approximation). In reality, thick lenses, wide-angle rays, and compound lens systems require more complex models. Aberrations such as spherical aberration, chromatic aberration, coma, and astigmatism cause deviations from the ideal prediction. Modern camera lenses use multiple elements (5-20 lenses) to correct these aberrations. For thick lenses, the lensmaker's equation and principal plane concepts must be used instead.

Was this tool helpful?