Skip to content

Diffraction Grating Calculator

d sin θ = mλ, with the orders that actually fit.

Work out Diffraction Grating. d sin θ = mλ, with the orders that actually fit. Names the assumption that breaks it.

Written and maintained by Mohit PatelLast checked August 4, 2026How we build these
nm

1 is the first bright fringe either side of the centre.

Diffraction angle, order 1

17.458°

3 orders available · slit spacing 1,666.7 nm

Diffraction angle17.4576°
Slit spacing d1.6667e-6 m
In nanometres1,666.67
Highest order that fits3

d sin θ = mλ. Because the angle depends on wavelength, a grating spreads light into a spectrum — and it separates colours far more sharply than a prism does, which is why spectrometers use gratings rather than glass. Only a finite number of orders exist, since sin θ cannot exceed 1. A finer grating spreads the spectrum more but fits fewer orders, which is the basic trade-off in choosing one.

How the Diffraction Grating Calculator works

Enter lines per millimetre, wavelength and order for the diffraction angle, along with how many orders exist at all. Orders beyond the maximum are refused rather than returned as an error value.

Also known as: grating equation calculator · diffraction angle calculator · d sin theta = m lambda · spectrometer grating calculator

Frequently asked questions

What is the grating equation?

d sin θ = mλ, where d is the slit spacing, m the order and λ the wavelength. Slit spacing is the reciprocal of lines per unit length.

Why do gratings beat prisms in spectrometers?

They disperse light far more sharply and the relationship between angle and wavelength is simple and linear in sin θ. A prism's dispersion depends on the glass and is strongly non-linear.

Why do only some orders exist?

Because sin θ cannot exceed 1. Once mλ passes d there is no angle that satisfies the equation, so that order simply does not appear.

Does a finer grating always work better?

Not always. More lines per millimetre spreads the spectrum further, which helps resolution, but it also reduces how many orders fit and can push the useful ones to awkward angles.

Put this calculator on your own site

Free to use, on any site, commercial or not. Paste this where you want it to appear. It is a plain iframe, so it works in WordPress, Squarespace, Wix, Webflow, Ghost and anything else that accepts HTML.

The one-line version
<iframe src="https://www.thecalclibrary.com/embed/diffraction-grating-calculator" width="100%" height="640" style="border:1px solid #e2e8f0;border-radius:12px" loading="lazy" title="Diffraction Grating Calculator"></iframe>
<p style="font:13px/1.5 system-ui,sans-serif;margin:6px 0 0;color:#64748b">Powered by <a href="https://www.thecalclibrary.com/diffraction-grating-calculator" style="color:#64748b">Diffraction Grating Calculator</a> from The Calc Library</p>

The only condition is that the credit line below the frame stays in place. That one line is what pays for the tool being free — it is how anyone else finds it.

Related calculators