Diffraction Grating Calculator
Diffraction grating calculator analyzes what happens when a light ray meets a surface with multiple apertures.
The formula
d sin θ = mλ; Bragg 2d sin θ = nλ; Rayleigh θ = 1.22λ ÷ D
Why a grating needs fine spacing
Diffraction maxima occur where the path difference between adjacent slits is a whole number of wavelengths, giving d sin θ = mλ. Since sin θ cannot exceed 1, an order only exists if mλ ≤ d — so a grating must have a line spacing comparable to the wavelength it is meant to disperse. A grating with spacing below one wavelength produces no orders at all beyond the central one.
Bragg reflection carries an extra factor of two because the ray must travel down to the next plane and back, doubling the path difference. Forgetting it halves every spacing derived from an X-ray pattern, which is the classic error in crystallography arithmetic.
The Rayleigh criterion sets a hard limit: an aperture of diameter D cannot resolve detail finer than about 1.22λ/D, no matter how good the optics or how much you magnify. This is diffraction, not imperfection, and it is why telescope apertures grow rather than their eyepieces — and why electron microscopes exist, since electrons have far shorter wavelengths than light.