Diffraction Grating Calculator

Enter a light wavelength, grating line density, and diffraction order to find the diffraction angle, grating spacing, and maximum order using d sin(θ) = mλ.

Quick Facts

Grating equation
d sin θ = mλ
d = slit spacing, θ = diffraction angle from the normal, m = integer order, λ = wavelength.
Grating spacing
d = 1/N
N is the groove (line) density; a 600 lines/mm grating has d ≈ 1.667 µm.
Order limit
m_max = floor(d/λ)
Higher orders vanish once sin θ would need to exceed 1.
Resolving power
R = m × N_total
Order times total illuminated grooves sets the smallest resolvable wavelength difference.

Your Results

Calculated
Diffraction Angle
-
θ = arcsin(mλ/d), from the grating normal
Grating Spacing
-
d = 1/N, distance between adjacent slits
Maximum Order
-
Highest integer m before sin θ exceeds 1
Fringe Position on Screen
-
y = L × tan θ at the chosen screen distance

Ready

Enter a wavelength, grating line density, and order, then press Calculate.

How the Diffraction Grating Equation Works

A diffraction grating is a surface ruled with many closely spaced, parallel slits or grooves. When light of wavelength λ passes through (or reflects off) the grating, each slit acts as a source of secondary wavelets. These wavelets interfere with each other, and bright fringes — called diffraction orders — appear only at the specific angles where light from every slit arrives in phase. This calculator uses the grating equation to find the diffraction angle, the physical slit spacing, the highest order the grating can produce, and where that order lands on a screen.

Deriving d sin θ = mλ

Consider two adjacent slits separated by distance d. Light leaving the two slits at angle θ from the grating's normal travels an extra path length of d sin θ compared to light from the neighboring slit. Constructive interference — a bright fringe — occurs whenever that extra path is a whole number of wavelengths: d sin θ = mλ, where m = 0, ±1, ±2, ... is the diffraction order. The m = 0 order is the undiffracted, straight-through beam; m = 1 is the first-order maximum, and so on. Because sin θ can never exceed 1, only a finite number of orders exist for a given d and λ — once m would push mλ/d above 1, the equation has no real solution and that order simply is not produced.

Line density, spacing, and units

Gratings are usually specified by how many lines (grooves) are ruled per unit length — commonly lines per millimeter, though some gratings are rated in lines per centimeter or lines per inch. The spacing between adjacent slits is the reciprocal of that density: d = 1/N. A 600 lines/mm grating, for example, has 1/600 mm ≈ 1667 nm between slits. This calculator converts wavelength and line density to a common nanometer/lines-per-mm basis internally, but when working by hand keep every quantity in compatible units — mixing micrometers with lines-per-inch without converting is a common source of order-of-magnitude errors.

Real-world applications

Diffraction gratings are the heart of spectrometers and monochromators, which spread light into its component wavelengths for spectroscopy, astronomy, and quality control in manufacturing. CDs and DVDs act as reflection gratings because their data tracks are regularly spaced grooves, which is why they show rainbow reflections under white light. Grating spectrometers use the fringe-position formula (y = L tan θ) to convert a diffraction angle into a physical distance on a detector or viewing screen, letting engineers pick the right detector spacing for a target wavelength range.

Frequently Asked Questions

What is the diffraction grating equation?
The grating equation is d sin θ = mλ, where d is the spacing between adjacent slits, θ is the diffraction angle measured from the grating's normal, m is an integer diffraction order (0, ±1, ±2, ...), and λ is the wavelength of light. It gives the angles at which light from every slit interferes constructively to produce a bright fringe.
How do I convert a grating's line density to its spacing?
Take the reciprocal of the line density: d = 1/N. A grating rated at 600 lines per millimeter has a spacing of 1/600 mm, or about 1666.7 nanometers. Convert lines per centimeter or lines per inch to lines per millimeter first (divide by 10 or by 25.4) before taking the reciprocal.
What is the maximum diffraction order for a grating?
Since sin θ cannot exceed 1, the grating equation only has solutions for m ≤ d/λ. The maximum usable order is m_max = floor(d/λ). For a 600 lines/mm grating (d ≈ 1667 nm) viewing 550 nm light, m_max = floor(1667/550) = 3, so only orders 0 through 3 (and their negative mirror images) are produced.
Why does a grating spread white light into a rainbow?
Because the diffraction angle θ depends on wavelength (sin θ = mλ/d), longer wavelengths (red) bend more than shorter wavelengths (blue) for the same order. This wavelength-dependent spreading, called angular dispersion, is what separates white light into a spectrum — the same effect that makes CDs and DVDs show rainbow colors.