Diffraction Grating Calculator
Predict where a spectral line lands on a screen, then work backward from a measurement to identify an unknown wavelength.
New to diffraction gratings? Start with the step-by-step guide ↓
Set up your spectroscope
For your first try, use 600 lines/mm, a screen distance of 200 mm, and 1st order. Both calculations use these settings.
Predict a line position
Measure an unknown wavelength
Enter a negative offset for the left side or a positive offset for the right.
A beginner’s guide to the calculator
Why does light make lines?
Imagine shining light through a clear sheet etched with hundreds of evenly spaced grooves. That sheet is a diffraction grating. The grooves spread the light out, and light waves from neighboring grooves reinforce each other in certain directions. A screen catches those directions as bright marks. For visible light, each wavelength corresponds to a color. We measure wavelengths in nanometers (nm). One nanometer is a millionth of a millimeter.
The bright spot straight ahead is the center, also called order zero. The closest matching pair for a single wavelength is first order, one on the left and one on the right. Pairs farther out are second order, third order, and so on, when they can form. Start with first order. If you see several colors, the first-order lines can include one mark for each wavelength on each side.
Predict where a line lands
- Set the grating to 600 lines/mm. That means 600 grooves fit across one millimeter. Set the screen 200 mm from the grating and select 1st order.
- Click Hydrogen α in the prediction box. It enters 656.28 nm, the wavelength of a red hydrogen line.
- The result is 85.68 mm on either side. On the ruler, look for the two solid marks at about −86 and +86 mm. Each is measured from 0.
- Change the screen distance to 400 mm. The marks move twice as far from 0. The angle and wavelength stay the same.
Work backward from a measurement
- Return to 600 lines/mm, 200 mm, and 1st order. Imagine a line appears 61 mm to the right of the center spot.
- Enter 61 in Measured offset from center. The answer is about 486.22 nm, close to the blue-green hydrogen β line at 486.13 nm. Rounding the measured position can change the answer slightly.
- Try −61 for the matching line on the left. You’ll get the same wavelength. Use the distance from the center to one line. If you measure between the matching left and right marks, divide that distance by two.
- Click Load a mystery line for another practice measurement. Compare your answer with the hydrogen presets, then click Reveal the mystery line.
What if I don’t see a line?
- “This order cannot form” means the grating cannot send that wavelength out in the selected order. Try a lower order.
- “Line runs parallel to screen” means the light travels sideways at 90° and never reaches a flat screen in front of the grating.
- “Beyond the ruler” means the calculated position is past the drawing’s ±300 mm range. The position in the result box still applies to the model.
- “No wavelength from the center spot” means you entered 0 mm. At the center, all wavelengths overlap. Choose a mark to either side.
How the grating equation works
For light arriving squarely at the grating, the bright orders obey d sin θ = mλ. Grating spacing d is the reciprocal of the lines per millimeter. The angle θ is measured from the straight-through beam and m counts the orders outward from the center.
On a flat screen a distance L away, the offset is x = L tan θ. To recover a wavelength, calculate the angle from |x| and L, then solve the grating equation for λ. The center spot is order zero and carries no wavelength information. The model assumes a perpendicular screen and ideal line positions. It leaves brightness and line width out of the calculation.
Scientific Inquiry
Predict what happens to a line’s position if you double the screen distance. Change only that distance, then use the new position to recover the original wavelength.
Read about model scope and predictions