Diffraction through a grating sends bright fringes only where waves from every slit arrive in step — d·sinθ = nλ. Drag the sliders below to change the wavelength, line density, slit count and screen distance, and watch the ray fan and the on-screen intensity pattern respond live.

Diffraction Grating

Monochromatic light hits a grating and fans into ordered bright fringes at d sin(angle) = n·(wavelength). Drag the sliders to move the orders, sharpen them with more slits, and spread them on the screen.

First-order angle  d sin = 1·wavelength
15.96°
7 bright fringes: orders up to n = 3 emerge on each side.
Grating numbers
Slit spacing d2.00 µm
Highest order nmax3
Bright fringes (2nmax+1)7
First order on screen28.6 cm
Wavelength550 nm
Line density500 /mm
Number of slits N6
Screen distance D100 cm
d = 1/(lines per metre) · orders exist only while n·(wavelength)/d ≤ 1 · screen trace spans ±150 cm and uses the N-slit intensity, so more slits means sharper maxima at the same angles.
Tip: push the line density up and watch the orders spread apart while the highest order drops — then add slits and see each bright fringe turn needle-sharp.

What Is the Diffraction Simulator?

The diffraction simulator is a free interactive physics lab that runs in your browser — nothing to install and no sign-up. Drag the wavelength, line density and slit count to watch the bright orders move and see d sin θ = nλ in action. It reports First-order angle d sin as you drag the sliders.

What you can change in the diffraction simulator
ControlRangeStep
Wavelength in nanometres380 – 700 nm5
Grating lines per millimetre100 – 1000 /mm10
Number of illuminated slits2 – 201
Distance from grating to screen20 – 200 cm5

What Each Slider Proves About the Grating Equation

The wavelength slider is the equation working in plain sight: since d·sinθ = nλ pins each bright order to its angle, dragging toward red pushes every order outward and dragging toward violet pulls the whole fan back in. The colour of the rays and the intensity trace follows the slider, so you can literally watch a longer wavelength demand a bigger angle.

The line density slider changes d itself: more lines per millimetre means a smaller slit spacing, and the readout updates d = 1/N as you drag. The orders spread wider apart — and, at the same time, fewer of them survive, because an order only exists while nλ/d ≤ 1. The readouts show the trade live: the first-order angle climbs while the highest visible order falls. You can confirm nmax = floor(d/λ) yourself against the fringe count, or hand the same numbers to the diffraction grating calculator for the full worked steps.

The number of slits is the subtle one, and it corrects the classic misconception directly: this sim's bright fringes are the maxima of the grating equation, not the single-slit minima, and adding slits does not move them at all. What changes is their sharpness — the bottom panel's peaks grow taller and needle-thin as N rises, because more slits cancel the light more completely between the maxima. That sharpening is the whole reason real gratings carry thousands of lines.

Finally, the screen distance turns angles into positions: each fringe lands at y = D·tanθ, so doubling D doubles the spacing on the screen without touching a single angle. It is the same geometry a spectrometer uses to convert an angle measurement into a wavelength — light whose speed in vacuum is the fixed speed of light, whatever its colour.

Frequently asked questions

How do I use this diffraction simulator?

Drag the four sliders and watch both panels respond: the wavelength slider moves every bright order, the line-density slider sets the slit spacing d, the slit-count slider sharpens the fringes, and the screen-distance slider spreads them across the screen. The readouts always show d, the first-order angle, the highest visible order and the total fringe count.

Why do the bright spots spread out when I increase the wavelength?

Because the grating equation d sin(angle) = n(wavelength) fixes each order's angle, and a longer wavelength needs a larger sine to keep the equation balanced. Slide from violet 380 nm toward red 700 nm and every order marches outward — the same reason a grating fans white light into a spectrum with red bent furthest.

What does adding more slits change?

Only the sharpness. The bright maxima sit wherever d sin(angle) = n(wavelength), which does not involve the slit count — but with more slits the waves cancel more completely everywhere else, so each fringe becomes taller and narrower. That is exactly why real gratings rule thousands of lines: needle-sharp fringes make precise wavelength measurements possible.

Does this show single-slit or grating diffraction?

Grating (multi-slit) diffraction. The bright peaks here are the maxima of d sin(angle) = n(wavelength). A single slit obeys the similar-looking a sin(angle) = m(wavelength), but that formula locates the dark minima of its pattern, not bright fringes — mixing the two is the classic diffraction mistake.

How many bright orders should I see?

Count n_max = floor(d/wavelength) on each side of the central maximum, giving 2·n_max + 1 fringes in total. With 500 lines/mm (d = 2.00 micrometres) and 550 nm light, d/wavelength = 3.6, so three orders fit each side — seven bright fringes. Raise the line density and watch the count fall as the pattern spreads.

References & formula source

  • E. Hecht — Optics, chapter on Fraunhofer diffraction and the diffraction grating.
  • Young & Freedman — University Physics with Modern Physics, chapter on Diffraction.
  • R. Nave — HyperPhysics, Georgia State University, "Diffraction Grating" section.
  • Further reading: Diffraction grating — Wikipedia