Diffraction Grating Equation Calculator

Solve grating problems fast with flexible inputs. Compute wavelength, diffraction angle, spacing, and line density. Check limits, export files, and compare sample data easily.

Uses the general grating relation: mλ = d(sinθi + sinθm).
Angle between incident ray and grating normal.
Angle between diffracted ray and grating normal.
Common values: 0, ±1, ±2, …
Provide when not solving for λ.
Visible range is roughly 380–750 nm.
Use either spacing or line density.
Typical spacing is ~0.5–5 µm.
Alternative to spacing: N = 1/d.
Most gratings are rated in lines/mm.

Formula used

The general diffraction grating condition for a reflective or transmissive grating is:

mλ = d (sin θi + sin θm)
m is diffraction order (integer), λ is wavelength, d is groove spacing, θi is incidence angle, and θm is diffraction angle, measured from the grating normal.

For normal incidence, θi = 0°, the relation simplifies to mλ = d sin θm.

How to use this calculator

  1. Select what you want to solve for (λ, θm, d, N, or m).
  2. Enter the known quantities and choose units for λ and d.
  3. Optionally check normal incidence to force θi = 0°.
  4. Click Calculate. The result appears above the form.
  5. Use the CSV or PDF buttons to export the result.

Example data table

These examples assume normal incidence (θi = 0°) and use sin θm = mλ/d.

Line density (lines/mm) Spacing d (µm) Order m Wavelength λ (nm) Predicted angle θm (deg)
600 1.6667 1 500 17.457
1200 0.8333 1 632.8 49.393
300 3.3333 2 450 15.659
Tip: If the computed sin(θm) exceeds 1, that order is not physically allowed.

What the diffraction grating equation tells you

A diffraction grating splits light into discrete directions where waves from adjacent grooves reinforce. The calculator applies mλ = d(sinθi + sinθm) to connect wavelength, groove spacing, diffraction order, and angles. With measured angles and a known grating rating, you can estimate spectral lines with practical accuracy for lab checks.

Key variables and typical ranges

Wavelength λ is often entered in nanometers; visible light is about 380–750 nm. Groove spacing d is commonly a few micrometers (for example, 600 lines/mm corresponds to d ≈ 1.667 µm). Orders m are integers (0, ±1, ±2, …), and higher |m| spreads lines further but reduces allowable angles.

From line density to spacing

Manufacturers usually specify gratings as line density N (lines/mm). The spacing is the reciprocal: d = 1/N (in mm), then convert units as needed. A 1200 lines/mm grating has d ≈ 0.833 µm, which produces noticeably larger diffraction angles than a 300 lines/mm grating for the same λ.

Normal incidence versus oblique incidence

For normal incidence (θi = 0°), the equation reduces to mλ = d sinθm. With oblique incidence, the sinθi term shifts the diffracted directions. This matters in spectrometers where the grating is tilted to place a chosen wavelength near the detector center.

Physical constraints and “missing orders”

A solution is only physical when |sinθm| ≤ 1. If mλ/d is too large, the calculator reports no real angle because that order cannot exist. As a quick check, if d = 1.0 µm and λ = 700 nm, then m = 2 would require sinθm = 1.4, so the second order is forbidden.

Using measured angles to estimate wavelength

In basic experiments, you measure θm for a known order and compute λ. For example, with θi = 0°, m = 1, and a 600 lines/mm grating (d ≈ 1.667 µm), θm = 17.46° gives λ ≈ 500 nm. Measuring both +m and −m and averaging helps cancel small alignment offsets.

Accuracy limits and practical tips

Main error sources include angle reading (±0.1° can shift λ by several nanometers), uncertain line density, and misidentifying the order. Keep the grating normal well-defined, use a narrow slit to sharpen maxima, and avoid saturating sensors. If results look inconsistent, try solving for d or N to cross-check the grating label.

Where this calculation is used

The grating equation underpins compact spectrometers, wavelength selection in lasers, and calibration of LEDs and discharge lamps. It is also used to map angular dispersion (how fast θ changes with λ), which affects resolving power in optical instruments. Exporting results to CSV or PDF makes lab notes easier to keep consistent.

FAQs

1) Can the order m be negative?
Yes. Positive and negative orders appear on opposite sides of the zero order. The magnitude |m| sets the path difference; the sign indicates direction relative to the grating normal.

2) Why does the calculator sometimes show “no real solution”?
That happens when the computed sin(θm) is outside −1 to +1. Physically, the chosen order cannot exist for the given wavelength and spacing. Try a smaller |m| or larger spacing.

3) Should I enter spacing d or line density N?
Either works. If your grating is labeled in lines/mm, enter N. If you already know spacing from a datasheet or calibration, enter d. The tool derives the other value automatically.

4) What angle reference does θi and θm use?
Angles are measured from the grating normal, not from the surface. If you measure from the surface, convert using θ(normal) = 90° − θ(surface) before entering values.

5) How do I improve wavelength accuracy?
Use sharp maxima (narrow slit), measure both +m and −m and average, and keep the grating aligned so θi is known. Small angle errors dominate, especially at larger diffraction angles.

6) Is m = 0 useful?
m = 0 is the zero-order beam, essentially specular transmission/reflection without dispersion. It’s helpful for alignment and as a reference direction, but it does not separate wavelengths.

7) What if my grating is blazed or has efficiency curves?
The equation still gives the allowed angles. Blaze and efficiency affect brightness of each order, not the geometric condition. If a line seems “missing,” it may be weak rather than forbidden.

Related Calculators

Optical waveguide lossOptical fiber attenuationOptical fiber dispersionFiber numerical apertureFiber V numberMode field diameterBending loss fiberCoupling efficiency fiberGraded index profileStep index fiber

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.