Diffraction Grating Calculator

Quick answer

The diffraction grating calculator finds the angles of the first five diffraction orders for light of a given wavelength hitting a grating with a given line density and angle of incidence.

Grating spacing d
1.66667 µm
Order 1 angle
18.6146 °
Order 2 angle
39.6726 °
Order 3 angle
73.2557 °
Order 4 angle
— °
Order 5 angle
— °

A diffraction grating – thousands of fine lines – splits light into its colours at precise angles. Spectrometers, CDs and the iridescence of some beetles all use this effect. The grating equation predicts where each wavelength appears.

How to use the Diffraction Grating Calculator

  1. Wavelength λ
  2. Grating density (lines/mm)
  3. Angle of incidence θᵢ

Results update as you type, every field has its own unit menu, and everything is calculated in your browser.

How it works

Enter the wavelength, the number of lines per millimetre and the angle of incidence (0° for light hitting the grating straight on). Orders that cannot exist show a dash.

Tips

  • Use the sign convention of the formula: real images and distances are positive in most lens equations.
  • Wavelength units matter – nm for visible light, µm for infrared.
  • Refractive index of air is about 1.000293; vacuum is exactly 1.
  • Angles are measured from the normal to the surface.

Common mistakes to avoid

  • Measuring angles from the surface instead of the normal.
  • Mixing focal length in mm and object distance in m.
  • Forgetting that a diverging lens has a negative focal length.

Inputs explained

Field What to enter
Wavelength λ Units: nm, µm, mm, m, pm, Å
Grating density (lines/mm) A number
Angle of incidence θᵢ Units: °, rad, arcmin, arcsec, mrad

Example values

How the main result changes when Wavelength λ changes and everything else stays at the example values above:

Wavelength λ (nm) Order 1 angle (°)
266 9.1837
399 13.8511
532 18.6146
665 23.5157
798 28.6071
1,064 39.6726

Formula

d·(sin θ_m + sin θ_i) = m·λ, d = 1/N

Worked example

Inputs — Wavelength λ: 532 nm; Grating density (lines/mm): 600; Angle of incidence θᵢ: 0 °.
Results — Grating spacing d = 1.66667 µm; Order 1 angle = 18.6146 °; Order 2 angle = 39.6726 °; Order 3 angle = 73.2557 °.

Key terms

Grating equation
d(sin θ_m + sin θ_i) = mλ.

Frequently asked questions

Why do higher orders disappear?

When mλ/d exceeds 1, no real angle exists.

How does line density affect the spread?

More lines per mm spread the colours over larger angles.

Why do CDs show rainbows?

Their tracks act as a reflection grating with about 625 lines/mm.

What is the zeroth order?

The undeviated beam, containing all wavelengths.

What formula does the Diffraction Grating Calculator use?

d·(sin θ_m + sin θ_i) = m·λ, d = 1/N.

Sources

  1. OpenStax – University Physics Volume 3
  2. HyperPhysics (Georgia State University)

Cite this calculator

Speedy Calculator. (2026). Diffraction Grating Calculator. Speedy Calculator. https://speedycalculator.com/calculators/physics/diffraction/