CalcOpenly

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.

Updated Checked against 8 worked examples

More options
Try
Image distance
cm
Image distance: 15 cm
Shown to 6 significant figures, half-up
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.

Worked examples

Converging lens f = 10 cm, object at 30 cm

Calculate
Lens or mirror
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: Python 3.8 fractions: 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
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: Python 3.8 fractions: 1/dᵢ = 1/10 − 1/5 = −1/10 ⇒ dᵢ = −10 cm

Diverging lens f = 10 cm, object at 20 cm

Calculate
Lens or mirror
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: Python 3.8 fractions: 1/dᵢ = −1/10 − 1/20 = −3/20 ⇒ dᵢ = −20/3 cm

Concave mirror at 2f: same size

Calculate
Lens or mirror
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: Python 3.8 fractions: 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.

How accurate is the thin lens, mirror and Snell's law calculator?

Accuracy depends on your inputs and the method's assumptions. Decimal arithmetic uses 50 significant digits, but estimates, numerical methods and source data can be less precise; the displayed rounding does not remove those limits. It is checked against 8 worked examples whose answers come from independent sources; for example, “Converging lens f = 10 cm, object at 30 cm” is checked against Python 3.8 fractions: 1/dᵢ = 1/10 − 1/30 ⇒ dᵢ = 15 cm, m = −½; P = 1/0.1 m.

Where does the method come from?

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

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.4 Refraction and §1.5 Total internal reflection
  3. Hecht, Optics (5th ed.), Table 4.1 — refractive indices

Checked against references

8 worked examples with independently sourced answers ship with this calculator. They run in the test suite; you can run them here too.

Related calculators

Allow optional Google Analytics to measure page visits? Calculators work either way. Privacy and choices

Optional analytics: off.