Diffraction grating calculator
Enter the grating as lines per millimetre or as its period, the wavelength of the light and the order you look at. The calculator gives the angle of that maximum, where it lands on a screen at the distance you set and how many orders can appear. Switch to the wavelength mode to measure a wavelength from an angle.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose whether to find the angle or the wavelength.
- Enter the grating as lines per millimetre (printed on most gratings) or as the period d in µm.
- Enter the wavelength in nm (or the measured angle) and the order m.
- Set the distance to the screen and read the angle, the spot position, the period, the line density and the highest order.
- Grating equation: d × sin θ = m × λ
- Period: d = 1 ÷ N, N in lines per unit length
- Wavelength from an angle: λ = d × sin θ ÷ m
- Highest order: the largest whole m with m × λ < d
- Position on a flat screen: y = L × tan θ
Worked example
A 600 lines/mm grating, green 500 nm light, first order, screen 1 m away:
- d = 1 ÷ 600 mm = 1.6667 µm
- sin θ = 1 × 0.5 ÷ 1.6667 = 0.3 → θ = 17.458°
- y = 1 × tan 17.458° = 31.45 cm from the centre
- d ÷ λ = 3.33, so up to order 3
The second order lies at sin θ = 0.6, θ = 36.87°, 75 cm from the centre.
Tips
- Use the small-angle shortcut with care. At 17° tan θ and sin θ already differ by 5 %; the calculator uses the exact functions.
- Higher orders spread colours more and separate close lines better, but they are dimmer.
- CDs and DVDs work as gratings – their track spacing sets d.
Frequently asked questions
What is the diffraction grating equation?
d × sin θ = m × λ, where d is the distance between neighbouring lines, θ the angle of the bright maximum, m the order (1, 2, 3 …) and λ the wavelength. It assumes the light falls straight onto the grating.
How do I get the period from lines per mm?
d = 1 mm ÷ lines per mm. 600 lines per mm gives d = 1.6667 µm, 1000 lines per mm gives 1 µm.
How many orders can I see?
sin θ cannot reach 1, so m must stay below d ÷ λ. With 600 lines per mm and 500 nm light d ÷ λ = 3.33, so three orders appear on each side of the centre.
How do I measure a wavelength with a grating?
Measure the angle of a known order and use λ = d × sin θ ÷ m. A first order at 30° through a 1000 lines per mm grating means λ = 1000 nm × 0.5 = 500 nm.