PhysicsLast updated: 2026-10-08

Thin Lens Calculator

Calculate image distance, magnification, and orientation (real/virtual, inverted/upright) using the thin lens equation (1/a + 1/b = 1/f) and ray tracing. Includes eyeglass diopters and compound lens systems.

Client-Side · Zero TelemetryPrivate & Secure
Quick Presets (Common Optics Setups)

Lens & Object SetupConvex Lens

10.0 cm
cm
20.0 cm
cm
4.0 cm
cm
Ray Tracing Diagram
ObjectImageFocus
F2FF'2F'ObjectImage
Image Distance b
+20.00 cm(behind lens, real)
Real ImageInverted
Magnification m-1.00×Equal size
Image Height h'4.00 cmInverted
Diopter Power+10.00 DD = 100/f
Magnifier M3.50×1 + 25/f
Worked Derivation & Sign Reasoning

1/a + 1/b = 1/f → 1/20.0 + 1/b = 1/10.0

1/b = 1/10.0 - 1/20.0 = 0.1000 - 0.0500 = 0.0500 → b = +20.00 cm

m = -b/a = -(+20.00) / 20.00 = -1.00

Since the object is beyond the focal point (a > f), light rays converge behind the lens to form an inverted real image. b > 0 denotes a real image; m < 0 denotes inversion.

ShareXfB!L

How to use

  1. 1

    Select calculation mode

    Choose from Lens Equation & Ray Tracing, Diopter & Eyeglass Conversion, or Compound Lens System.

  2. 2

    Enter focal length and object distance

    Specify convex lens (f > 0) or concave lens (f < 0), along with object distance a.

  3. 3

    Inspect image position, magnification and ray diagram

    View image distance b, real/virtual type, upright/inverted orientation, magnification m, and ray tracing diagram in real time.

Features

  • Calculates image distance b, magnification m, real/virtual and inverted/upright states
  • Dynamic SVG ray tracing diagram with 3 principal rays and focal points
  • One-click presets for classic setups (equal real image, magnified virtual image, concave lens)
  • Bidirectional conversion between diopters (D) and focal length f (cm/m)
  • Reading glasses diopter estimate based on near point and working distance
  • Two-lens compound focal length calculation (in contact or spaced by d)
  • Step-by-step mathematical substitution and sign convention reasoning
  • Runs 100% locally in browser with zero tracking and no data transmitted

Use cases

Physics education & homework verification

Master thin lens sign conventions and eliminate confusion between real/virtual and upright/inverted images with interactive ray tracing.

Eyeglass & contact lens diopter understanding

Convert prescription power (e.g. -3.00 D or +1.50 D) into exact optical focal length in centimeters.

Optical systems & compound lens design

Simulate combined focal length and optical power for telescopes, microscopes, and multi-lens camera systems.

Details

The thin lens equation 1/a + 1/b = 1/f relates the object distance a, image distance b, and focal length f for lenses whose thickness is negligible compared to their focal lengths.

According to the standard sign convention, a converging (convex) lens has f > 0, while a diverging (concave) lens has f < 0. For a real object (a > 0), a positive image distance (b > 0) indicates a real image formed on the opposite side of the lens, whereas a negative image distance (b < 0) represents a virtual image on the same side. The lateral magnification is m = -b/a; a negative sign signifies an inverted image, and a positive sign signifies an upright image.

For a convex lens, placing an object beyond 2f produces a diminished inverted real image; at 2f, an equal-size inverted real image; between f and 2f, an enlarged inverted real image. When placed inside the focal point (a < f), light rays diverge and form a magnified upright virtual image, functioning as a magnifying glass. For a concave lens, images are always upright, diminished virtual images regardless of object position.

Lens optical power is measured in diopters (D), defined as the reciprocal of the focal length in meters: D = 1 / f [m] = 100 / f [cm]. Reading and hyperopia lenses use positive diopters (+D, converging), while myopia corrective lenses use negative diopters (-D, diverging). For instance, a -3.00 D lens has a focal length of -33.33 cm.

When two thin lenses with focal lengths f₁ and f₂ are separated by distance d, the combined focal length is given by f_comb = (f₁ × f₂) / (f₁ + f₂ - d). When placed in contact (d = 0), total optical power is simply the sum of individual diopters: D_comb = D₁ + D₂.

This tool combines algebraic formula evaluation with an interactive SVG ray tracing diagram showing the three principal rays (parallel ray, optical center ray, and focal ray), providing intuitive geometric understanding alongside precise calculations.

FAQ

How do you distinguish real and virtual images in the lens formula?

When the computed image distance b is positive (b > 0), refracted rays converge to form a real image that can be projected on a screen. When b is negative (b < 0), rays diverge and appear to emanate from behind the object, creating a virtual image that can only be viewed directly by looking through the lens.

What happens when the object is exactly at the focal point (a = f)?

Rays emerging from the lens become parallel, meaning no image forms at any finite distance (b = infinity). In the equation, 1/b = 1/f - 1/a = 0. Searchlights and optical collimators make use of this property.

What does the minus sign in magnification m = -b/a mean?

A negative magnification (m < 0) signifies an inverted image (upside down). A positive magnification (m > 0) indicates an upright image. The actual size ratio is given by the absolute value |m|.

What does an eyeglass prescription of -2.00 D mean?

Diopters (D) represent optical power, defined as the reciprocal of focal length in meters. The negative sign designates a concave (diverging) lens for myopia, with a focal length of 100 / (-2.00) = -50 cm.

What happens when two lenses are placed together in contact?

When two thin lenses are in contact, their optical powers add directly: D_comb = D₁ + D₂. In terms of focal lengths, 1/f_comb = 1/f₁ + 1/f₂, or f_comb = (f₁ × f₂) / (f₁ + f₂).

All processing happens in your browser. Your files are never uploaded.

Verified: Verified equal real image (a=20, f=10 -> b=20, m=-1.0), magnified real image (a=15, f=10 -> b=30, m=-2.0), magnifying glass virtual image (a=6, f=10 -> b=-15, m=+2.5), concave lens (a=30, f=-15 -> b=-10, m=+0.333), diopter conversion (+2.5D -> 40cm, -3.0D -> -33.33cm), compound lens (f1=20, f2=30, d=0 -> f=12cm), and focal point error handling with automated tests

Did you know?

In the 17th century, Antonie van Leeuwenhoek ground tiny single spherical lenses with focal lengths under 1 mm (>1000 diopters), achieving over 200x magnification to discover bacteria for the first time in human history.

Optional usage measurement settings

Only with your consent, a random browser ID and tool/learning events are sent to measure return visits. This is pseudonymous measurement. Inputs, answers, keys, files and search terms are excluded. Consent expires after 90 days. Declining does not limit any feature.

Measurement is off.

Retention and privacy