TSE.
MathematicsFinanceHealthPhysicsEngineeringBrowse all

Physics · Optics · Optics & Light

Diffraction Grating Calculator

Calculates the diffraction angle, wavelength, or grating spacing using the diffraction grating equation for any diffraction order.

Calculator

Advertisement

Formula

d is the grating spacing (distance between adjacent slits, in meters), \theta is the diffraction angle measured from the normal to the grating (in degrees), m is the diffraction order (integer: 0, \pm 1, \pm 2, \ldots), and \lambda is the wavelength of the incident light (in meters). The grating spacing d is related to the number of lines per unit length N by d = 1/N.

Source: Hecht, E. (2002). Optics (4th ed.). Addison-Wesley. §10.2; NIST Physical Measurement Laboratory.

How it works

A diffraction grating is an optical element with a large number of equally spaced parallel slits or grooves. When coherent or broadband light strikes the grating, each slit acts as a secondary source, and the resulting interference pattern produces bright maxima (principal maxima) at specific angles that depend on the wavelength. This wavelength-selective separation is the basis of every grating spectrometer and monochromator.

The governing relationship is the grating equation: d sinθ = mλ, where d is the centre-to-centre spacing of adjacent grooves, θ is the angle of diffraction measured from the grating normal, m is an integer order (0, ±1, ±2, …), and λ is the wavelength of light. The grating spacing d is the reciprocal of the groove density N expressed in lines per unit length (d = 1/N). For the calculation to be physically valid, the quantity mλ/d must lie strictly between −1 and +1; otherwise no real diffraction angle exists for that order.

Two derived quantities are particularly important in practice. Angular dispersion dθ/dλ = m/(d cosθ) measures how rapidly the diffraction angle changes with wavelength — a higher value means the grating spreads the spectrum more widely, reducing crosstalk between adjacent spectral lines. Resolving power R = mN (where N is the total number of illuminated grooves) quantifies the grating's ability to distinguish two wavelengths that are very close together, with a larger R meaning finer spectral resolution.

Worked example

Suppose you have a 600 lines/mm diffraction grating and illuminate it with sodium D-line light at a wavelength of 589 nm. You want the first-order diffraction angle (m = 1).

Step 1 — Grating spacing: d = 1/600 mm = 0.001667 mm = 1667 nm = 1.667 μm.

Step 2 — Apply the grating equation: sinθ = mλ/d = (1 × 589 nm) / (1667 nm) = 0.35333.

Step 3 — Diffraction angle: θ = arcsin(0.35333) = 20.69°.

Step 4 — Angular dispersion: dθ/dλ = m/(d cosθ) = 1 / (1667 nm × cos 20.69°) = 1 / (1667 × 0.9354) nm = 6.41 × 10−4 rad/nm = 0.0367 °/nm. This means two wavelengths 1 nm apart will be separated by about 0.037° in the first order.

Step 5 — Resolving power (assuming the full 25 mm aperture is illuminated): N = 600 × 25 = 15 000 grooves; R = mN = 1 × 15 000 = 15 000. The grating can resolve wavelengths as close as λ/R = 589/15000 ≈ 0.039 nm apart in first order.

Limitations & notes

The grating equation assumes perfectly periodic, infinitely thin slits and normal (or specified angle of) incidence; real gratings have finite groove profiles, blaze angles, and manufacturing tolerances that shift efficiency across orders. This calculator uses the transmission/reflection grating equation in the Fraunhofer (far-field) regime and does not account for the blaze condition or polarisation-dependent efficiency. For oblique incidence the full form d(sinα + sinβ) = mλ applies, where α and β are the angles of incidence and diffraction respectively — this calculator assumes α = 0 (normal incidence). Resolving power R = mN is the theoretical maximum; practical resolution is also limited by aberrations, slit width, detector pixel size, and illumination coherence. When |mλ/d| ≥ 1 the requested order does not exist and the calculator returns NaN for the angle and dispersion — reduce the order or increase d.

Frequently asked questions

What is the diffraction grating equation?

The diffraction grating equation is d sin θ = mλ, where d is the groove spacing, θ is the diffraction angle from the grating normal, m is the integer diffraction order, and λ is the wavelength of light. It describes the directions in which constructive interference produces bright maxima when light passes through or reflects off a periodic grating structure.

How do I convert lines per mm to grating spacing?

Grating spacing d is simply the reciprocal of the groove density. If a grating has N lines per millimetre, then d = 1/N mm. For example, a 600 lines/mm grating has d = 1/600 mm ≈ 1.667 μm = 1667 nm. Always convert d to the same units as your wavelength before using the grating equation.

What does diffraction order m mean?

The diffraction order m is an integer (0, ±1, ±2, …) that counts which constructive-interference maximum you are observing. Order m = 0 is the straight-through (undiffracted) beam at θ = 0 regardless of wavelength, so it carries no spectral information. Orders m = ±1 are the most commonly used in spectroscopy because they balance diffraction angle and efficiency; higher orders give larger dispersion but lower intensity and can overlap with lower orders of shorter wavelengths.

Why does the calculator return no angle for some orders?

A real diffraction angle only exists when |mλ/d| ≤ 1, because sin θ cannot exceed 1. If your chosen order m, wavelength λ, and grating spacing d produce a ratio outside this range, the requested diffraction maximum physically cannot exist — the order is said to be evanescent. To fix this, reduce the order number, use a shorter wavelength, or choose a grating with a larger spacing (fewer lines per mm).

What is the resolving power of a diffraction grating and how is it calculated?

Resolving power R = mN quantifies the minimum wavelength difference the grating can separate: R = λ/Δλ, where Δλ is the smallest resolvable wavelength interval. N is the total number of grooves illuminated by the beam, and m is the diffraction order. A 1200 lines/mm grating with a 50 mm beam in second order gives N = 60 000 grooves and R = 120 000, sufficient to resolve lines just 0.005 nm apart near 600 nm.

Last updated: 2025-01-15 · Formula verified against primary sources.