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)
How it's calculated S
Solve the thin-lens / mirror equation
di1=f1−do1=0.11−0.31⇒di=0.15m
Magnification
m=−dodi=−0.30.15=−0.5,hi=mho=−0.01m
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
Measure the angle of incidence from the normal. A ray 60° from the surface is 30° from the normal.
Compute sin θ₂ = (n₁ ÷ n₂) × sin θ₁. Air to glass at 30°: (1 ÷ 1.5) × 0.5 = 0.3333.
Take the inverse sine: θ₂ = asin(0.3333) = 19.47°.
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.
Example
n₁
n₂
Incidence
Refraction
Critical angle
index concept
1
1.5
30 deg
19.471221°
None
total reflection
1.5
1
45 deg
TIR
41.810315°
default water
1.000293
1.333
45 deg
32.047229°
None
normal incidence
1
1.5
0 deg
0°
None
equal indices
1.5
1.5
45 deg
45°
None
grazing equal indices
1.5
1.5
90 deg
90°
None
radian incidence
1
1.5
pi/6 rad
19.471221°
None
below critical
1.5
1
30 deg
48.590378°
41.810315°
exact critical
2
1
30 deg
90°
30°
just above critical
2
1
30.0001 deg
TIR
30°
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.
Example
f
dₒ
dᵢ
m
Power D
default lens
10
30
15
-0.5
10
inside focal length
10
5
-10
2
10
diverging lens
-10
30
-7.5
0.25
-10
concave mirror
10
30
15
-0.5
10
convex mirror
-10
30
-7.5
0.25
-10
solve object
10
30
15
-0.5
10
solve focal
10
30
15
-0.5
10
opposite focal sign warning
-6
30
-5
0.166667
-16.666667
metre result
0.1
0.3
0.15
-0.5
10
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
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.
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.