Physics & Chemistry
Diffraction Grating Calculator (Angles, Orders and Spot Positions)
A diffraction grating is a surface ruled with thousands of fine, evenly spaced lines. When light passes through or reflects from it, each line acts as a tiny source, and the waves from all the lines interfere. They reinforce one another only in particular directions, where the extra path between neighbouring lines is a whole number of wavelengths. This condition is the grating equation: the line spacing times the sine of the diffraction angle equals the order number times the wavelength. The zeroth order passes straight through; the first order on each side is bent by an angle that depends on the wavelength; higher orders are bent further. Because the angle depends on wavelength, a grating spreads white light into its colours, like a prism but with much greater and more predictable dispersion, which is why gratings are at the heart of spectrometers used in chemistry, astronomy and telecommunications. Gratings are usually described by their number of lines per millimetre; the line spacing is one millimetre divided by that number. A grating with 600 lines per millimetre has a spacing of about 1.67 micrometres, so green light at 500 nanometres appears in the first order at about 17.5 degrees, the second at about 36.9 degrees and the third at about 64.2 degrees, while no fourth order exists because the sine would exceed one. This calculator takes the lines per millimetre, the wavelength, the order and an optional screen distance, and returns the diffraction angle, the line spacing, the highest possible order, the spot position on the screen and a table of all orders.
How to use this calculator
- Enter the number of lines per millimetre of the grating.
- Enter the wavelength of the light in nanometres.
- Enter the diffraction order you are interested in.
- Optionally enter the distance to a flat screen.
- Read the angle, the spot position and the table of all orders.
Measuring wavelengths
Rearranging the grating equation gives λ = d sin θ ÷ m, so measuring the angle of a known order with a grating of known spacing gives the wavelength. This is how laboratory spectrometers measure spectral lines.
Classroom experiments shine a laser through a grating and measure spot positions on a wall. Using the tangent relation y = L tan θ is more accurate than the small-angle shortcut at large angles.
Resolving power
The ability of a grating to separate two close wavelengths, its resolving power, equals the order number times the number of illuminated lines. Large gratings used in higher orders can separate lines differing by tiny fractions of a nanometre.
CDs and DVDs act as reflection gratings because their tracks are closely spaced, about 1.6 µm for a CD and 0.74 µm for a DVD, which is why they show rainbow colours.
Formula & method
Grating equation: d sin θ = m λ, normal incidenceLine spacing d = 1 mm ÷ lines per mmHighest order m_max = ⌊d ÷ λ⌋Spot position on a flat screen y = L tan θd sin θ = mλ with d = 1 mm/N; m_max = ⌊d/λ⌋; spot position y = L tan θ.
Worked example
Green light at 500 nm on a 600 lines/mm grating
- d = 1 ÷ 600 mm = 1.667 µm
- First order: sin θ = 500 nm ÷ 1,667 nm = 0.3, θ ≈ 17.46°
- On a screen 1 m away: y = tan 17.46° ≈ 0.314 m
Answer: The first-order spot appears about 31 cm from the central spot.
Frequently asked questions
What is the zeroth order?
It is the light that passes straight through without deviation. All wavelengths overlap there, so the zeroth order of white light is white.
Why are there two first orders?
Diffraction occurs symmetrically on both sides of the central beam, so there are first, second and higher orders on each side.
Does the formula work for reflection gratings?
Yes, for light arriving perpendicular to the grating. For other angles of incidence, the equation becomes d(sin θ + sin θᵢ) = mλ.
Why does red light diffract more than blue?
The diffraction angle grows with wavelength, and red light has a longer wavelength than blue, so it is bent further.
What is a blazed grating?
A grating whose grooves are shaped to direct most of the light into one particular order, improving efficiency for spectrometers.
Can I use it for X-rays?
Crystal lattices act as gratings for X-rays, described by Bragg's law. Ruled gratings are used mainly for ultraviolet, visible and infrared light.