DigitHelm

Lens Equation Calculator | Optics

Calculate focal length, object distance, image distance, and magnification for thin lenses.

What Is the Lens Equation Calculator | Optics?

The thin lens equation relates the focal length (f) of a lens to the object distance (d₀) and image distance (dᵢ). It predicts where an image will form, whether it will be real or virtual, and whether it will be magnified, reduced, or the same size as the object. The same equation applies to concave and convex mirrors with appropriate sign conventions.

  • Solve any variable: given two of f, d₀, dᵢ the tool computes the third, useful for designing optical systems.
  • Image type classification: automatically identifies real vs virtual, upright vs inverted, and magnified vs reduced.
  • Mirror mode: applies the same equation to concave and convex mirrors using the mirror sign convention.
  • Lensmaker's equation: optionally compute focal length from lens radii of curvature and refractive index.
  • Multi-lens systems: enter two lenses with their separation to trace the combined image.
  • Ray diagram description: shows a text description of the three principal rays used to locate the image.

Formula

1/f = 1/d₀ + 1/dᵢ
Thin Lens Equation  |  Magnification: m = −dᵢ / d₀ = hᵢ / h₀
VariableMeaningSign Convention
fFocal lengthPositive: converging (convex) lens; Negative: diverging (concave) lens
d₀Object distance (from lens)Positive: real object (on incoming side)
dᵢImage distance (from lens)Positive: real image (opposite side); Negative: virtual image (same side as object)
mMagnificationPositive: upright image; Negative: inverted image; |m|>1: magnified
h₀Object heightPositive by convention
hᵢImage heightPositive: upright; Negative: inverted

How to Use

  1. 1Select the lens type: Converging (convex) or Diverging (concave). This sets the sign of f.
  2. 2Choose which variable to solve for: focal length f, object distance d₀, or image distance dᵢ.
  3. 3Enter the known two values in the input fields. Include units (mm, cm, or m).
  4. 4Press Calculate (or Enter) to see the third value, magnification, image type (real/virtual, upright/inverted, magnified/reduced), and image height if object height is provided.
  5. 5Toggle "Mirror mode" to apply the same equation to concave/convex mirrors instead of lenses.
  6. 6Use presets (human eye, camera lens, magnifying glass, eyepiece) to explore common optical systems.
  7. 7Click Reset (or Escape) to clear all fields.

Example Calculation

Example 1, Converging lens, real image

A converging lens with f = 10 cm, object at d₀ = 30 cm:

1/dᵢ = 1/f − 1/d₀ = 1/10 − 1/30 = 3/30 − 1/30 = 2/30 dᵢ = 30/2 = 15 cm (positive → real image) m = −dᵢ/d₀ = −15/30 = −0.5 (negative → inverted; |m|<1 → reduced) Image is real, inverted, reduced, on opposite side

Example 2, Diverging lens, virtual image

A diverging lens with f = −15 cm, object at d₀ = 20 cm:

1/dᵢ = 1/f − 1/d₀ = 1/(−15) − 1/20 = −4/60 − 3/60 = −7/60 dᵢ = −60/7 ≈ −8.57 cm (negative → virtual image) m = −dᵢ/d₀ = −(−8.57)/20 ≈ +0.43 (positive → upright; |m|<1 → reduced) Image is virtual, upright, reduced, same side as object
A diverging lens ALWAYS produces a virtual, upright, reduced image regardless of object position. A converging lens produces a real, inverted image when the object is beyond the focal point, and a virtual, upright, magnified image (like a magnifying glass) when the object is inside the focal point.

Understanding Lens Equation | Optics

How the Thin Lens Equation Works

The thin lens equation (1/f = 1/d₀ + 1/dᵢ) is derived from Snell's Law of refraction applied to paraxial rays, rays that make small angles with the optical axis. Under this paraxial approximation, all parallel rays converge (or diverge from) the same focal point, making the geometry tractable. For "thick" lenses, more complex equations are needed, but the thin lens model is accurate enough for most practical optical calculations.

The equation has the same mathematical form as the mirror equation for spherical mirrors, with the same sign conventions. This algebraic similarity reflects the underlying geometric optics: in both cases, you are finding where a wavefront converges after reflection or refraction by a curved surface.

Sign Conventions

The "real is positive" sign convention used here is standard for most physics textbooks:

  • Object distance d₀ is positive when the object is on the incoming side of the lens (the usual case).
  • Image distance dᵢ is positive for a real image (forms on the opposite side from the object) and negative for a virtual image (appears on the same side as the object).
  • Focal length f is positive for converging (convex) lenses and negative for diverging (concave) lenses.
  • Magnification m is negative for inverted images and positive for upright images. |m| > 1 means magnified; |m| < 1 means reduced.

Types of Images: Real vs Virtual

  • Real image: light rays actually converge at the image location. Can be projected onto a screen. Always inverted. Forms when d₀ > f for a converging lens.
  • Virtual image: light rays only appear to diverge from the image location, they don't actually meet there. Cannot be projected. Always upright. Forms when d₀ < f (magnifying glass) or with any diverging lens.

Optical Applications

  • Human eye: the cornea (rigid, ~40 D) and crystalline lens (variable, 20–33 D) together focus light on the retina. Diopter = 1/f in meters. Glasses correct the total focal length for myopia (too short) or hyperopia (too long).
  • Camera lens: moves to adjust d₀/dᵢ ratio for focusing at different distances; zoom lenses vary f.
  • Microscope: two-lens system, objective (short f, high magnification) and eyepiece (acts as magnifying glass for the intermediate image).
  • Telescope: objective collects parallel rays from distant objects (dᵢ ≈ f); eyepiece re-magnifies the real image formed at the focal plane.
  • Projector: object (slide/chip) placed just beyond f so a large real image forms at dᵢ ≫ d₀ (very large magnification, inverted).

The Lensmaker's Equation

The focal length of a thin lens made from glass with refractive index n is:

1/f = (n − 1) × [1/R₁ − 1/R₂]

where R₁ and R₂ are the radii of curvature of the two lens surfaces (positive if the center of curvature is on the right/transmission side). This lets optical engineers design lenses with specific focal lengths by choosing appropriate glass and surface curvatures.

Frequently Asked Questions

What is the difference between a real and virtual image?

A real image forms where light rays actually converge after passing through the lens. You can project it onto a screen (like a movie projector or camera sensor). It always forms on the opposite side of the lens from the object and is always inverted.

A virtual image appears where light rays seem to diverge from, but they never actually meet there, like your reflection in a flat mirror. It cannot be projected onto a screen, is always upright, and forms on the same side as the object. A diverging lens always produces a virtual image; a converging lens produces one when the object is inside the focal point (magnifying glass mode).

Why does a magnifying glass work?

A magnifying glass is a converging lens used with the object placed closer than the focal length (d₀ < f). In this configuration, the lens equation gives a negative dᵢ, meaning the image is virtual, upright, and magnified. It appears behind the lens on the same side as the object.

The magnification in this mode is m = f / (f − d₀). Placing the object very close to the focal point (but just inside it) can give very high magnification, the image forms far away and very large. The eye places itself on the far side of the lens and views the virtual image at a comfortable distance (~25 cm).

What does diopter mean for eyeglass prescriptions?

Diopter (D) is the unit of optical power: D = 1/f in meters. A +2.0 D lens has focal length 0.5 m = 50 cm. Positive diopters (converging lenses) correct hyperopia (farsightedness); negative diopters (diverging lenses) correct myopia (nearsightedness).

For example, a −3.0 D prescription means f = −33.3 cm, a diverging lens that shifts the eye's focal point backward to land precisely on the retina. The cornea and crystalline lens together form a compound lens system, and glasses add or subtract optical power to bring the total to the right value.

When is the image at infinity?

When the object is placed exactly at the focal point (d₀ = f), the lens equation gives 1/dᵢ = 1/f − 1/f = 0, so dᵢ = ∞. The outgoing light rays are perfectly parallel, this is called collimation.

This is how collimators work: place a point source at the focal point of a converging lens and the output is a parallel beam. The reverse is also true: parallel rays from a distant object (like a star) converge exactly at the focal point, this is why the focal point is the image location for objects at infinity, and why telescopes use this to form a real image at the focal plane of the objective.

How do I calculate the total magnification of a two-lens system (microscope or telescope)?

For two thin lenses separated by distance d, trace the image through each lens in sequence:

  • Use d₀₁ and f₁ to find dᵢ₁ (image from lens 1)
  • The image from lens 1 becomes the object for lens 2: d₀₂ = d − dᵢ₁
  • Use d₀₂ and f₂ to find dᵢ₂
  • Total magnification = m₁ × m₂ = (−dᵢ₁/d₀₁) × (−dᵢ₂/d₀₂)

For a compound microscope, the approximate formula is: M_total ≈ −(tube length / f_objective) × (25 cm / f_eyepiece). The negative sign indicates the final image is inverted relative to the original object.

What is the focal length of the human eye?

The relaxed human eye has a total focal length of about 17 mm (the distance from the back principal plane of the eye's optics to the retina). The key optical components are:

  • Cornea: ~40 D of power (fixed, cannot change shape)
  • Crystalline lens: 15–25 D (variable via ciliary muscles, this is accommodation)
  • Total relaxed eye: ~60 D

When the ciliary muscles contract, the lens becomes more curved (higher D), allowing focus on near objects. This accommodation range decreases with age, causing presbyopia (difficulty with near focus after age ~40–45).

Can the lens equation be used for mirrors too?

Yes, the mirror equation has the identical form: 1/f = 1/d₀ + 1/dᵢ, where f = R/2 and R is the radius of curvature of the mirror. The sign conventions are similar but adapted for reflection rather than refraction:

  • Concave (converging) mirror: f is positive
  • Convex (diverging) mirror: f is negative
  • Real image (forms in front of mirror, same side as incoming light): dᵢ positive
  • Virtual image (appears behind the mirror): dᵢ negative

The magnification equation m = −dᵢ/d₀ is identical for both lenses and mirrors. Toggle "Mirror mode" in this calculator to apply the equation with mirror sign conventions.

Related Calculators