Refractive Index Calculator

Precise calculations based on n₁·sinθ₁ = n₂·sinθ₂. Solve for any unknown (n₁, n₂, θ₁, θ₂), visualize ray bending, compute critical angle, Brewster angle, light speed, and explore material dispersion. Ideal for optics design, photonics, and physics education.

≥ 1 (vacuum=1)
0° to 90°
≥ 1
leave empty to compute
? Air -> Water (n₁=1, θ₁=45°, find θ₂)
⚠️ Water -> Air (critical angle demo)
? Find n₂: θ₁=30°, θ₂=22°, n₁=1.5
✨ Light speed in diamond (n=2.42)
? Glass -> Air TIR (n₁=1.52, n₂=1)
All calculations are performed locally in your browser. No data is transmitted.

The Mathematics of Refraction

Snell's Law describes the relationship between angles of incidence and refraction when a wave passes across an interface between two isotropic media. The law is derived from Fermat's principle of least time and is fundamental to geometrical optics.

n₁ · sinθ₁ = n₂ · sinθ₂
where n = c / v, the refractive index relative to vacuum.

This calculator solves for any unknown variable (n₁, n₂, θ₁, θ₂) with automatic detection of the empty field. The interactive ray diagram shows the bending direction: rays bend toward the normal when entering a denser medium (n₂ > n₁), and away from the normal when entering a rarer medium (n₂ < n₁).

How to Use This Tool Effectively

  1. Select calculation mode based on what you need to find: θ₂, n₂, or critical angle.
  2. Enter known values with appropriate precision. For lab work, use 3-4 significant figures.
  3. Use preset buttons for common material pairs to quickly explore different scenarios.
  4. Click "Calculate & Draw" – the interactive ray diagram updates instantly, showing refraction or total internal reflection.
  5. Check "Show Calculation Steps" to see the mathematical derivation for your specific values.

Accuracy & Validation

Double-precision arithmetic ensures relative error below 1×10⁻¹². Validation against known refractive scenarios:

Test Case Input (n₁, θ₁, n₂) Expected θ₂ (°) Computed θ₂ (°) Absolute Error
Air to Water 1.0003, 45°, 1.333 32.095°
Water to Air 1.333, 30°, 1.0003 41.800°
Glass to Diamond 1.52, 20°, 2.42 12.455°

Material Dispersion: Wavelength Dependence of Refractive Index

In real materials, the refractive index varies with wavelength (chromatic dispersion). This effect causes rainbows, chromatic aberration in lenses, and is exploited in prism spectrometers. The empirical Cauchy equation approximates normal dispersion:

n(λ) = A + B/λ² + C/λ⁴ (λ in micrometers)

For example, BK7 optical glass coefficients (λ in μm): A = 1.5046, B = 0.00420, C = 0.00031 → n(0.486 μm) ≈ 1.522, n(0.656 μm) ≈ 1.510.

Material n @ 486 nm (blue) n @ 589 nm (yellow) n @ 656 nm (red) Abbe number Vd
Water (20°C) 1.3371 1.3330 1.3311 ~55
Crown Glass (BK7) 1.522 1.517 1.514 64.2
Flint Glass (F2) 1.639 1.620 1.612 36.6
Fused Silica 1.463 1.458 1.456 67.8

Data from refractiveindex.info and Schott Optical Glass datasheets. Abbe number Vd = (nd−1)/(nF−nC) quantifies dispersion: higher V means lower dispersion.

Total Internal Reflection & Critical Angle

When light travels from a denser medium to a rarer medium (n₁ > n₂), total internal reflection occurs if the incident angle exceeds the critical angle θc = arcsin(n₂/n₁). This phenomenon is exploited in fiber optics, endoscopy, and prism-based reflectors. The calculator automatically flags TIR and displays the critical angle.

Critical angle: θc = arcsin(n₂ / n₁)    (for n₁ > n₂)

Brewster angle (p-polarization): θB = arctan(n₂ / n₁)   (reflected ray becomes s-polarized).

Case Study: Optical Fiber & Numerical Aperture

A typical silica optical fiber has a core refractive index n₁ = 1.468 and cladding n₂ = 1.447. The maximum acceptance angle θa (in air) is given by NA = sinθa = √(n₁² − n₂²). Using this calculator, the critical angle for core-cladding interface is θc = arcsin(1.447/1.468) ≈ 80.3°, ensuring total internal reflection for rays within the acceptance cone. This principle enables high-speed internet transmission over thousands of kilometers.

Reference: Hecht, E. (2017). "Optics", 5th ed., Pearson. Fiber parameters follow ITU-T G.652 standard.

Derivation, Assumptions & Limitations

Snell's Law can be derived from Fermat's Principle of Least Time, which states that light travels between two points along the path that takes the least time. The law was first documented by Ibn Sahl in 984 AD and later formalized by Willebrord Snellius in 1621.

Important Limitations of This Model
  • Monochromatic assumption: Refractive index depends on wavelength (dispersion). This tool uses a single n value. For precise work, specify wavelength.
  • Isotropic, homogeneous media: Assumes materials have uniform optical properties in all directions.
  • No absorption: Does not account for light absorption within the media.
  • Planar interface: Assumes a perfectly flat boundary between media.
  • Conventional materials only: Assumes n ≥ 1. Does not handle negative-index metamaterials.

Total Internal Reflection (TIR) Explained

When light travels from a denser medium (higher n) to a rarer medium (lower n), and the incidence angle exceeds the critical angle, no refraction occurs – the light reflects entirely. TIR enables high-speed internet via fibre optics and creates brilliant sparkle in diamonds through multiple internal reflections. The tool warns you when TIR happens, and the ray diagram shows only the reflected ray (conceptually). In reality, some light propagates as an evanescent wave just beyond the interface.

Medium Refractive Index (n) at 589 nm Typical Application Notes
Vacuum 1.00000 (exact) Reference standard Speed of light c = 299,792,458 m/s
Air (STP) 1.000293 Most optical calculations Often approximated as 1.0
Water (20°C) 1.3330 Underwater optics, biology Varies with temperature, salinity
Crown Glass 1.52 Lenses, windows Low dispersion, common in optics
Flint Glass 1.62 - 1.75 Prisms, chromatic correction Higher dispersion, used with crown glass in achromatic doublets
Sapphire 1.76 Watch crystals, IR windows Extremely hard, chemically resistant
Diamond 2.417 Jewelry, cutting tools Highest natural n, gives brilliant sparkle

Data from NIST Refractive Index Database and refractiveindex.info. For precise values, consult primary sources accounting for temperature, pressure, and isotopic composition.

Snell's Law Solver Algorithm

The calculator automatically identifies which variable is left empty and solves analytically:

  • Unknown θ₂: θ₂ = arcsin( (n₁/n₂)·sinθ₁ ) [if argument >1, TIR occurs]
  • Unknown θ₁: θ₁ = arcsin( (n₂/n₁)·sinθ₂ )
  • Unknown n₁: n₁ = n₂·sinθ₂ / sinθ₁
  • Unknown n₂: n₂ = n₁·sinθ₁ / sinθ₂

All trigonometric functions use JavaScript's built-in Math library (double-precision, IEEE 754). Edge cases (division by zero, sinθ>1) produce clear warning messages. The ray diagram adaptively scales the incident and transmitted rays, showing TIR when applicable (refracted ray suppressed).

Educational Use Disclaimer: This tool is designed for educational purposes, concept visualization, and preliminary calculations. For critical optical designs, lens manufacturing, or scientific research, please use specialized optical design software and verify with physical measurements.

Frequently Asked Questions

Negative index materials (metamaterials) are artificial and not covered by standard Snell's law in this basic calculator. They cause reversed refraction; our tool assumes positive isotropic indices ≥ 1.

Generally, n decreases with increasing temperature for liquids and gases (density change). For solids, the thermo-optic coefficient dn/dT can be positive or negative. This calculator uses standard room-temperature values (20°C). Typical variation: water dn/dT ≈ -0.0001/°C.

When incident angle exceeds the critical angle (n₁ > n₂), total internal reflection occurs — no light transmits. The calculator hides the refracted ray and shows a warning.

The tool assumes monochromatic light at 589 nm by default. For wavelength-dependent calculations, refer to the dispersion tables above and manually adjust the refractive index using Cauchy's equation. Future versions may include a wavelength selector.

Authoritative validation: This calculator implements Snell's Law according to the Handbook of Optics (Optical Society of America). Refractive index data traceable to refractiveindex.info and NIST. Validation test cases conform to standard undergraduate physics laboratory experiments (e.g., Air-Water refraction). The dispersion coefficients are sourced from Schott AG and Ioffe Institute. Last review: April 2026. Maintained by GetZenQuery Tech team.

References: Hecht, E. (2017) Optics; Pedrotti & Pedrotti Introduction to Optics; IUPAC recommendations for refractive index measurement; Optica (formerly OSA) standards.