Snell's Law Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Why a Snell’s Law Ray Diagram Matters

A Snell’s law calculation describes a directional change at a boundary: light can bend as it enters a material with a different refractive index. The result is more useful beside a ray diagram, because the canvas redraws the incident and refracted paths whenever you change either index or the incoming angle. You can see the transmitted ray move toward or away from the normal, or see it become a reflected ray when total internal reflection occurs. The responsive drawing preserves the angle relationship on phones and desktop screens, and its caption states the current configuration for people using screen readers.

For learners meeting refraction for the first time, this Snell’s law visual links the trigonometric result to a visible path. Increasing the second medium’s index moves the refracted beam closer to the normal; reducing that index can move it away. At sufficiently large incidence angles when light travels toward a lower index, the transmitted solution ceases to exist and the ray reflects. Trying these changes in the calculator makes the distinction between ordinary refraction and total internal reflection easier to recognize.

For a quick optics check, the refraction diagram also provides a compact way to compare plausible material-index inputs before a more detailed optical model is needed. It is not a replacement for full ray tracing through curved or multilayer surfaces, but it clearly shows the one-interface geometry that Snell’s law governs. A screenshot can also communicate which medium is incident, which is refracted, and which angle is measured from the normal.

Mathematics of Snell’s-Law Refraction

Snell’s law relates the two refractive indices to the sines of the angles measured from the normal:

Formula: n_1 ⁢ sin ⁡ θ_1 = n_2 ⁢ sin ⁡ θ_2

n1sinθ1=n2sinθ2

Here n1 is the refractive index of the incident medium and n2 is the index of the medium the light enters. The calculator treats θ₁ as the entered incident angle and solves for θ₂, with both angles measured from the dashed normal rather than from the interface. Rearranging the relationship gives:

Formula: θ_2 = arcsin ⁡ (n_1 ⁢ sin ⁡ θ_1) / n_2

θ2=arcsinn1sinθ1n2

This refraction calculation assumes homogeneous, isotropic media and a flat interface. It uses one refractive-index value for each medium, so it does not model changes with position, direction, polarization, or wavelength. If the value inside arcsine has magnitude greater than one, there is no real transmitted angle; the calculator reports total internal reflection instead of displaying an invalid angle.

Snell’s law can be motivated by Fermat’s principle, in which the optical path takes a stationary travel time, or by electromagnetic boundary conditions at an interface. In either view, the result applies locally at a smooth boundary. That local rule is why the same relationship remains central when more complex optical systems are broken into individual surface crossings.

Worked Example: Air-to-Water Refraction

Consider light traveling from air, with n1=1.000, into water, with n2=1.333, at an incident angle of 30°. Snell’s law gives θ2=arcsin1.000sin30°1.333, so the refracted angle is roughly 22°. Entering those values shows a ray bending toward the normal, as expected when the second index is higher. If the second index is changed to glass with n2=1.50, the calculated refracted angle is near 19.5°, showing the stronger bend toward the normal.

The same calculator also illustrates the opposite direction. A ray starting in water and approaching an air boundary at 30° still has a valid refracted solution, because the critical angle for water-to-air transmission is greater than 30°. Increase the water-side incident angle beyond the critical angle and the calculator instead reports total internal reflection. The reflected path in the canvas then remains in the incident medium.

To explore that transition, keep the two indices fixed and increase θ₁ gradually. The refracted angle moves farther from the normal as the critical condition is approached. At the threshold it reaches 90° relative to the normal; beyond it, no transmitted angle is available. This continuous progression is the key geometric idea behind total internal reflection.

Snell’s Law Scenario Comparison

These refraction scenarios use a 40° incident angle and show how the index ratio controls the calculated transmitted angle or the onset of total internal reflection.

Medium 1 (n₁) Medium 2 (n₂) Refracted Angle θ₂
Air (1.00) Water (1.33) 28.9°
Air (1.00) Glass (1.50) 25.4°
Water (1.33) Air (1.00) 58.8°
Glass (1.50) Air (1.00) 74.6°

At 40°, each transition in the table still has a real refracted angle. When light moves from a higher index to a lower index, θ₂ is larger than θ₁ and can approach 90° as the critical angle is approached. Total internal reflection occurs only after the entered incident angle makes n1sinθ1/n2 exceed one in magnitude.

Entering comparable values lets you watch how the transmitted ray responds to the ratio of the two indices. A larger second index bends the ray toward the normal, while a smaller second index bends it away. Check that the indices are assigned in the same order as the ray travels: swapping the media changes both the result and whether total internal reflection is possible.

How to Interpret the Snell’s Law Diagram

In the calculator’s refraction diagram, the horizontal line is the boundary between media and the vertical dashed line is the normal. The yellow ray approaches from the upper medium at θ₁. If transmission is possible, a blue ray continues into the lower medium at θ₂; if total internal reflection occurs, the blue ray returns through the upper medium. The ray lengths are only illustrative, so use the angles and caption—not the drawn distances—as the meaningful output.

The upper and lower background colors distinguish the two media, but they do not identify particular substances. Their refractive indices are entirely determined by the values you enter. Resizing the page redraws the same interface geometry around the canvas center, so the visual remains useful without implying a physical length scale.

Limitations and Real-World Refraction Insights

This Snell’s law calculator models one idealized interface. It does not account for roughness, curved surfaces, absorption, scattering, or dispersion, and real refractive index can vary with wavelength; in that context, n is not necessarily a single color-independent value. The result is nevertheless a useful first-order description of refraction. Fiber-optic systems, for example, rely on an index contrast and incidence geometry that permit total internal reflection, while underwater imaging is affected by the same change in ray direction at a water-air boundary.

Many practical optical systems contain several surfaces rather than one. A lens can have curved boundaries, and each ray can strike a different point with a different local normal. Engineers commonly apply Snell’s law at each crossing in a sequential ray model. The single-boundary result calculated here is therefore a building block for understanding those more elaborate designs, not a complete model of them.

Enter indexes and incident angle to find the refracted angle.
The diagram will update after you enter values.

Snell’s Law Refraction Relay Challenge

Practice Snell's law by steering photons through shifting media—match the refracted beam to glowing windows before each pulse crosses the interface.

n₁ sin θ₁ = n₂ sin θ₂

Score 0
Best 0
θ₁ Aim
θ₂ Output
Target
Chain ×1
n₁ 1.000 → n₂ 1.333 Pulse ETA 0.0s
Baseline interface

Drag or swipe on the canvas (keyboard ←/→ for accessibility) to tune θ₁. Press space to trigger a stabilization burst when ready.