Calculateus

Diffraction Grating Calculator

Calculate the diffraction angle for a given order of light passing through a diffraction grating.

Result

Diffraction Angle
19.269°
Grating Spacing (d)
1.6667 µm

About the Diffraction Grating Calculator

This calculator determines the angle at which light of a given wavelength forms a bright diffraction maximum after passing through a diffraction grating of known line density. It is built for optics students and anyone working with spectrometers or grating-based instruments who needs to predict where a specific spectral order will appear.

How It Works

You enter the grating's line density in lines per millimeter, the light's wavelength in nanometers, and the diffraction order (an integer such as 1, 2, or 3). The calculator first converts the line density into a physical slit spacing, then solves the grating equation for the sine of the diffraction angle, and finally converts that angle into degrees. It also reports the grating spacing itself in micrometers.

d = 1 / (lines per mm x 1000), spacing in meters. sin(theta) = m * wavelength / d. theta = arcsin(sin(theta)), converted to degrees

Formula & Methodology

The grating spacing d is the physical distance between adjacent slits, found by taking the reciprocal of the line density after converting lines-per-millimeter into lines-per-meter. The wavelength, entered in nanometers, is converted to meters. Plugging these into the grating equation d*sin(theta) = m*wavelength and solving for theta gives the diffraction angle for the chosen order m. Higher orders and longer wavelengths both push the diffraction angle further from the grating's normal.

Examples

First-order green light

A grating with 600 lines/mm and 550 nm light in the first order (m=1) gives a grating spacing of about 1.6667 micrometers and a diffraction angle of roughly 19.35 degrees.

Second-order diffraction on the same grating

Using the same 600 lines/mm grating and 550 nm wavelength but switching to second order (m=2), the diffraction angle increases to about 41.31 degrees, showing how higher orders bend light further from the normal.

Advantages

  • Converts line density directly into physical grating spacing, saving a manual reciprocal and unit-conversion step
  • Checks whether the requested order actually produces a valid diffraction maximum before returning an angle, avoiding a mathematically impossible result
  • Reports the grating spacing alongside the angle, giving a useful intermediate value for further optical calculations

Common Mistakes

  • Entering wavelength in micrometers or another unit instead of the expected nanometers, which throws off the diffraction angle by orders of magnitude
  • Requesting a high diffraction order on a fine grating without checking that a valid solution exists, leading to the calculator's no-maximum error
  • Mixing up line density (lines per millimeter) with grating spacing (distance between lines), which are inverse quantities

Edge Cases to Watch For

  • If the grating line density is entered as zero or negative, the calculator returns an error since spacing cannot be computed from an invalid density.
  • If the calculated sine of the angle exceeds 1 in magnitude, meaning the requested order does not physically exist for that wavelength and grating density, the calculator returns an error instead of an invalid angle.
  • Very high orders or long wavelengths on a fine (high line density) grating are the most likely combinations to exceed the sin(theta) = 1 limit and trigger the no-solution error.

Common Use Cases

  • Physics and optics students solving grating equation problems for lab assignments
  • Spectroscopy technicians predicting where specific wavelengths will appear when configuring an instrument
  • Educators demonstrating how diffraction order and wavelength affect the spread of a spectrum
Written & fact-checked by the Calculateus TeamLast updated August 5, 2026How we verify our formulas

Frequently asked questions

What is the diffraction grating equation?

d sin(θ) = mλ relates the spacing between a grating's slits (d), the angle at which a bright fringe appears (θ), the diffraction order (m, an integer), and the light's wavelength (λ). Diffraction gratings are used in spectrometers to spread light into its component wavelengths for analysis.

Conclusion

The grating equation links physical slit spacing, wavelength, and diffraction order into a single predictable angle, and this calculator automates the conversions needed to apply it. Its built-in check for an impossible order keeps results limited to physically achievable diffraction maxima.