CalcOpenly
English

Thin lens, mirror and Snell's law calculator

Thin lens and mirror equation for image distance, object distance or focal length, with magnification; Snell's law refraction and critical angle.

Drafted with AI writing toolsUpdated Checked examples: 8

More options
Try
Image distance
cm
Image distance: 15 cm
Significant figures: 6; Nearest, ties away from zero
Object distance
30cm
Focal length (signed)
10cm
Magnification
−0.5
Image height (negative = inverted)
−1cm
Image
Real, inverted, reduced
Optical power
10D

With f = 10 cm and the object 30 cm away, the image forms 15 cm beyond the lens: real, inverted, reduced (m = −0.5).

Converging lens: ray diagram (heights stretched to fit)

objectF′Fimage
How it's calculated S
  1. Solve the thin-lens / mirror equation

    1di=1f−1do=10.1−10.3⇒di=0.15 m\frac1{d_i} = \frac1f - \frac1{d_o} = \frac1{0.1} - \frac1{0.3} \Rightarrow d_i = 0.15\ \mathrm{m}
  2. Magnification

    m=−dido=−0.150.3=−0.5,hi=m ho=−0.01 mm = -\frac{d_i}{d_o} = -\frac{0.15}{0.3} = -0.5,\quad h_i = m\,h_o = -0.01\ \mathrm{m}
  3. Sign convention

    Real is positive: distances to real objects and images are positive, virtual ones negative; converging lenses and concave mirrors have f > 0. For a lens a real image forms on the far side.

About the thin lens, mirror and Snell's law calculator

The thin-lens equation, 1/f = 1/dₒ + 1/dᵢ, links the focal length f, the object distance dₒ and the image distance dᵢ, and the same equation holds for spherical mirrors. Give any two and the calculator solves the third, then finds the magnification m = −dᵢ/dₒ, the image height, whether the image is real or virtual, and the power in dioptres (1/f with f in metres). Snell's law, n₁ sin θ₁ = n₂ sin θ₂, gives the refracted angle at a boundary and the critical angle beyond which light is totally reflected.

With the defaults, a converging lens of f = 10 cm and an object 30 cm away, the image forms 15 cm behind the lens, inverted and half size (m = −0.5), the arrangement in a camera. Light passing from air into water at 45° bends to 32.05°.

Signs follow the real-is-positive convention: virtual images have negative dᵢ, and diverging lenses and convex mirrors have negative f. Lenses are thin, so thickness and aberrations are ignored.

How to use Snell's law and the thin lens equation

Snell's law, n₁ sin θ₁ = n₂ sin θ₂, gives a ray's angle after it crosses into a new medium, with both angles measured from the normal. From air (n ≈ 1) into glass (n = 1.5) at 30°, sin θ₂ = 0.5 ÷ 1.5 = 0.333, so the ray continues at 19.47°.

The thin lens equation, 1/f = 1/dₒ + 1/dᵢ, locates the image formed by a lens or curved mirror. A 10 cm converging lens with an object 30 cm away forms a real image 15 cm behind it, inverted and half the object's size.

The normal is the line perpendicular to the surface. The lens equation assumes a thin lens and rays close to its axis.

What the refractive index means

The refractive index n = c/v compares the speed of light in a vacuum, c, with its speed in the material, v. Glass with n = 1.5 slows light to about 2.0 × 10⁸ m/s, two-thirds of its vacuum speed.

"Index of refraction" and "refraction coefficient" usually name this same n. Fresnel reflection and transmission coefficients are different quantities: they describe how much of the light is reflected or passes through, not which way it bends.

Typical indices for yellow light at 589 nm:

  • Vacuum: 1 exactly
  • Air: 1.000293
  • Water: 1.333
  • Acrylic: 1.49
  • Ordinary glass: about 1.5
  • Diamond: 2.417

The index changes with wavelength, which is why a prism spreads white light into colors. Use the value for the wavelength you care about.

How to apply Snell's law by hand

  1. Measure the angle of incidence from the normal. A ray 60° from the surface is 30° from the normal.
  2. Compute sin θ₂ = (n₁ ÷ n₂) × sin θ₁. Air to glass at 30°: (1 ÷ 1.5) × 0.5 = 0.3333.
  3. Take the inverse sine: θ₂ = asin(0.3333) = 19.47°.
  4. If sin θ₂ comes out above 1, there is no refracted ray. The light is totally internally reflected.

Light entering a higher index bends toward the normal, and light entering a lower index bends away from it. A ray at 0° passes straight through, and equal indices give no bending at any angle (OpenStax, refraction).

Angles are rounded to six decimal places, and the pi/6 rad row is 30° written in radians. "None" means there is no critical angle, because the light enters an equal or higher index.

Examplen₁n₂IncidenceRefractionCritical angle
index concept11.530 deg19.471221°None
total reflection1.5145 degTIR41.810315°
default water1.0002931.33345 deg32.047229°None
normal incidence11.50 deg0°None
equal indices1.51.545 deg45°None
grazing equal indices1.51.590 deg90°None
radian incidence11.5pi/6 rad19.471221°None
below critical1.5130 deg48.590378°41.810315°
exact critical2130 deg90°30°
just above critical2130.0001 degTIR30°

Critical angle and total internal reflection

Going from a higher index to a lower one, the critical angle is θc = asin(n₂/n₁). From glass (1.5) into air (≈ 1), θc = asin(0.6667) = 41.81°. Past that angle Snell's law would need sin θ₂ > 1, so no light crosses and all of it reflects back.

At exactly the critical angle the refracted ray runs along the surface, at 90°. In the last two rows, 30° from a medium of index 2 just grazes out, and 30.0001° is reflected.

Into air, the critical angle is about 48.6° for water and 24.4° for diamond. Diamond's small critical angle traps light inside a cut stone, and the same effect keeps light inside an optical fiber (OpenStax, total internal reflection).

How to solve the thin lens equation

For f = 10 cm and dₒ = 30 cm, 1/dᵢ = 1/10 − 1/30 = 2/30, so dᵢ = 15 cm. The magnification is m = −dᵢ/dₒ = −15/30 = −0.5: a 2 cm object gives a 1 cm image, upside down.

Lens power is P = 1/f with f in meters. A 10 cm lens has P = 1/0.1 m = +10 diopters, the unit used on eyeglass prescriptions.

Move the object inside the focal length, to 5 cm, and 1/dᵢ = 1/10 − 1/5 = −1/10. The image distance is −10 cm: a virtual, upright image twice the size (m = +2). That is how a magnifying glass works.

At dₒ = 2f (20 cm) the image also sits at 20 cm, inverted and the same size (m = −1). With the object exactly at the focal point, the rays leave parallel and no finite image forms.

Sign convention for lenses and mirrors

These rules follow the real-is-positive convention:

  • Focal length: positive for a converging lens or concave mirror, negative for a diverging lens or convex mirror.
  • Image distance: positive for a real image, which forms beyond a lens or in front of a mirror; negative for a virtual one.
  • Magnification: negative when the image is inverted; a magnitude above 1 means it is enlarged.
  • Mirrors: the same equation applies, and a spherical mirror's focal length is half its radius of curvature.

Enter the focal length as a size without a sign; the chosen lens or mirror type supplies it. A virtual image distance is entered as a negative number.

When you know both distances and solve for f, the sign identifies the element. An object at 30 cm with a virtual image at −5 cm gives 1/f = 1/30 − 1/5, so f = −6 cm, which only a diverging lens or convex mirror can produce.

Thin lens and mirror examples

Distances are in centimeters except in the "metre result" row, which uses meters. Magnification has no unit, power is in diopters, and values are rounded to six decimal places.

ExamplefdₒdᵢmPower D
default lens103015-0.510
inside focal length105-10210
diverging lens-1030-7.50.25-10
concave mirror103015-0.510
convex mirror-1030-7.50.25-10
solve object103015-0.510
solve focal103015-0.510
opposite focal sign warning-630-50.166667-16.666667
metre result0.10.30.15-0.510

A concave mirror and a converging lens with the same f put the image at the same distance. A diverging lens or convex mirror always forms a virtual, upright, reduced image of a real object, as the −7.5 cm rows show (OpenStax, thin lenses).

Common mistakes

  • Measuring from the surface. A ray 60° from the surface is 30° from the normal. Into glass it bends to 19.47°; plugging in 60° gives a wrong 35.26°.
  • Degree and radian mix-ups. A calculator in radian mode reads sin 30 as −0.988 instead of 0.5.
  • Swapping the media. n₁ is the medium the light comes from. Reversing the indices can turn an ordinary refraction into total internal reflection.
  • Dropping a minus sign. A virtual image or a diverging lens needs a negative distance or focal length. Losing it turns a magnifying-glass image into a real one.
  • Power in centimeters. Diopters need f in meters: a 10 cm lens is +10 D, not +0.1.
  • Thick lenses. The thin lens equation ignores lens thickness and aberrations, so it only approximates multi-element camera lenses.

Wavelength inside a medium

Refraction keeps the frequency and shortens the wavelength to λ/n: 589 nm light is about 442 nm inside water. To convert between wavelength, frequency and photon energy, use the wavelength calculator.

Worked examples

Converging lens f = 10 cm, object at 30 cm

Calculate
Lens or mirror
Optical element
Converging lens
Solve for
Image distance
Focal length (size, without sign)
10 cm
Object distance
30 cm
Show distances in
cm
Image distance
15 cm
Magnification
-0.5
Image
Real, inverted, reduced
Optical power
10 D

Checked against: 1/dᵢ = 1/10 − 1/30 ⇒ dᵢ = 15 cm, m = −½; P = 1/0.1 m

Object inside the focal length: magnifying glass

Calculate
Lens or mirror
Optical element
Converging lens
Solve for
Image distance
Focal length (size, without sign)
10 cm
Object distance
5 cm
Show distances in
cm
Image distance
-10 cm
Magnification
2
Image
Virtual, upright, magnified

Checked against: 1/dᵢ = 1/10 − 1/5 = −1/10 ⇒ dᵢ = −10 cm

Diverging lens f = 10 cm, object at 20 cm

Calculate
Lens or mirror
Optical element
Diverging lens
Solve for
Image distance
Focal length (size, without sign)
10 cm
Object distance
20 cm
Show distances in
cm
Image distance
-6.66667 cm
Magnification
0.333333
Image
Virtual, upright, reduced

Checked against: 1/dᵢ = −1/10 − 1/20 = −3/20 ⇒ dᵢ = −20/3 cm

Concave mirror at 2f: same size

Calculate
Lens or mirror
Optical element
Concave mirror
Solve for
Image distance
Focal length (size, without sign)
10 cm
Object distance
20 cm
Show distances in
cm
Image distance
20 cm
Magnification
-1
Image
Real, inverted, same size

Checked against: 1/dᵢ = 1/10 − 1/20 ⇒ dᵢ = 20 cm, m = −1 (OpenStax UP3 §2.3)

Questions

What is the thin lens equation?

1/f = 1/dₒ + 1/dᵢ, where f is the focal length, dₒ the object distance and dᵢ the image distance, all measured from the lens. For f = 10 cm and an object at 30 cm, 1/dᵢ = 1/10 − 1/30, so dᵢ = 15 cm. A negative dᵢ means a virtual image on the same side as the object, as seen through a magnifying glass.

How do you calculate the magnification of a lens?

m = −dᵢ/dₒ, and the image height is m times the object height. A negative m means the image is inverted; |m| above 1 means it is enlarged. An object 5 cm from a 10 cm magnifying glass gives dᵢ = −10 cm and m = +2, an upright virtual image twice the size. At dₒ = 2f the image is real, inverted and the same size (m = −1).

What is the critical angle for total internal reflection?

θc = arcsin(n₂/n₁), which exists only when light heads into a medium with a lower index (n₁ > n₂). Into air it is 41.8° from glass (n = 1.5), 48.6° from water (1.333) and 24.4° from diamond (2.417), which is why cut diamonds sparkle. A ray meeting the surface at more than θc from the normal is reflected completely, the principle behind optical fibre.

What is Snell's law?

n₁ sin θ₁ = n₂ sin θ₂: the refractive index times the sine of the angle from the normal is the same on both sides of a boundary. Light entering water (n = 1.333) from air at 45° continues at 32.0°, bent towards the normal because water has the higher index. Going the other way the ray bends away from the normal, and beyond the critical angle it cannot leave at all.

What is lens power in dioptres?

Power P = 1/f with f in metres, measured in dioptres (D). A converging lens with f = 10 cm has P = +10 D, and a diverging lens with f = −50 cm has −2 D. Spectacle prescriptions use this unit: short sight is corrected with negative (diverging) lenses and long sight with positive ones, and the powers of thin lenses in contact add.

About this calculator

1f=1do+1di,m=−dido;n1sin⁡θ1=n2sin⁡θ2,θc=arcsin⁡n2n1\frac1f = \frac1{d_o} + \frac1{d_i},\quad m = -\frac{d_i}{d_o};\qquad n_1\sin\theta_1 = n_2\sin\theta_2,\quad \theta_c = \arcsin\frac{n_2}{n_1}

Sources

  1. OpenStax University Physics Volume 3, §2.3 Spherical mirrors and §2.4 Thin lenses
  2. OpenStax University Physics Volume 3, §1.3 Refraction and §1.4 Total internal reflection
  3. Hecht, Optics (5th ed.), Table 4.1 — refractive indices

Checked against references

This calculator includes 8 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.

Put this calculator on your site

Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.

Height
Preview the embed

Keep the credit line. It is the only condition, and it is what keeps these calculators free.