Refraction happens when light crosses from one medium into another medium with a different refractive index.
The refractive index \(n\) measures how strongly a material slows light relative to vacuum. When the light speed changes at the boundary,
the ray usually changes direction as well. This bending effect is governed by Snell’s law,
\[
n_1 \sin \theta_1 = n_2 \sin \theta_2.
\]
In this equation, \(\theta_1\) is the angle of incidence and \(\theta_2\) is the angle of refraction.
Both angles are measured from the normal, meaning the line perpendicular to the interface.
This detail matters a lot: the angles are not measured from the surface itself. If light goes from a lower-index medium into a higher-index medium,
such as air into glass, the ray bends toward the normal. If it goes from a higher-index medium into a lower-index medium,
such as glass into air, the ray bends away from the normal.
Rearranging Snell’s law gives
\[
\sin \theta_2 = \frac{n_1}{n_2}\sin \theta_1.
\]
Once that value is found, the transmitted angle comes from the inverse sine:
\[
\theta_2 = \sin^{-1}\!\left(\frac{n_1}{n_2}\sin \theta_1\right).
\]
For example, if light travels from air into glass with \(n_1=1.00\), \(n_2=1.50\), and \(\theta_1=40^\circ\), then
\[
\sin\theta_2 = \frac{1.00}{1.50}\sin(40^\circ) \approx 0.4285,
\]
so
\[
\theta_2 = \sin^{-1}(0.4285) \approx 25.4^\circ.
\]
Because the glass has the larger refractive index, the refracted ray bends toward the normal, and indeed \(25.4^\circ\) is smaller than \(40^\circ\).
This is the standard classroom example of refraction at a plane boundary.
A second important idea is the critical angle. It exists only when light starts in the denser optical medium and tries to enter a lower-index medium,
so the condition is \(n_1 > n_2\). At the critical angle, the refracted ray just skims along the boundary, meaning \(\theta_2 = 90^\circ\).
Substituting this into Snell’s law gives
\[
n_1\sin\theta_c = n_2\sin 90^\circ = n_2,
\]
and therefore
\[
\theta_c = \sin^{-1}\!\left(\frac{n_2}{n_1}\right).
\]
For glass to air, using \(n_1=1.50\) and \(n_2=1.00\),
\[
\theta_c = \sin^{-1}\!\left(\frac{1.00}{1.50}\right) \approx 41.8^\circ.
\]
This number explains an easy source of confusion: the critical angle of about \(41.8^\circ\) belongs to the direction glass to air, not air to glass.
If light starts in air and goes into glass, no critical angle applies for that travel direction.
If the incident angle in the higher-index medium becomes larger than the critical angle, Snell’s law demands a value of \(\sin\theta_2\) greater than 1.
That is impossible for any real angle. In that situation, no transmitted ray exists and the light undergoes total internal reflection (TIR).
The entire geometric ray stays in the first medium and reflects back from the boundary.
This is why optical fibers can guide light efficiently, and why underwater surfaces can appear mirror-like when viewed at steep angles.
The animated diagram in this calculator shows the interface, the normal, the incoming ray, and either the refracted ray or the reflected ray in a TIR case.
The top and bottom regions are labeled with their refractive indices so you can immediately connect the geometry to the numbers.
When a refracted ray exists, the calculator shows how the outgoing direction changes depending on the relative size of \(n_1\) and \(n_2\).
When TIR occurs, the warning explains that the inverse-sine step fails because the Snell-law argument exceeds 1.
This solver is especially useful for introductory optics, for checking homework, and for building intuition about everyday phenomena such as the “swimming pool illusion,”
where submerged objects appear shifted because light changes direction as it leaves water and enters air.
At more advanced levels, the same ideas lead into graded-index media, wave optics, Fresnel coefficients, and fiber-optic design,
but the plane-interface Snell-law model remains the cleanest foundation.