Snell's Law Calculator (Refraction)
Refracted angle for light crossing between any two media, with a refraction-angle plot.
Snell's law
Refracted angle against incidence angle
At your n1/n2. The dot is your angle.
Show the Larzscript program that just ran
Run a calculation to see the exact program.
This is the real program the page sent to the Larzscript interpreter (compiled to WebAssembly) in your browser. The library it imports is the same code the automated tests check.
The formula
Worked example, computed above
Air into water, 45° incidence: refracted angle 32.12°.
What is verified
Snell's law is checked to round-trip: refracting in and then back out at the same two indices returns the original angle exactly, and total internal reflection is confirmed to raise past the critical angle — see tests/test_emwaves.lz.
Frequently asked questions
What is Snell's law?
n₁ sin(θ₁) = n₂ sin(θ₂) — light bends when it crosses into a medium with a different refractive index. Light entering water (n = 1.33) from air at 45° bends to about 32.12°, closer to the normal.
Why does light bend toward the normal entering water?
Because water has a higher refractive index than air — light always bends toward the normal when entering a denser (higher-index) medium, and away from the normal when leaving it.
What is total internal reflection?
Going from a higher to a lower index (e.g. water to air) past a critical angle, Snell's law has no solution — all the light reflects instead of refracting. This calculator raises a clear error in exactly that case rather than returning a wrong number; use the critical-angle formula in the library to find that limiting angle directly.
Does this handle any pair of materials?
Yes — enter any two refractive indices (glass ~1.5, diamond ~2.42, water ~1.33, air ~1.0) and any angle of incidence from 0° to 90°.
Every number on this page is computed by the open-source larzscript-physics library (emwaves, physmath), written in Larzscript, and checked against independent references in its test suite. How it is verified →