Diffraction Calculator
What is the Diffraction Calculator?
What this calculator does
Enter a grating's line density, a wavelength of light, and a diffraction order. The calculator returns the grating spacing in meters and the diffraction angle in degrees. Optics students, spectroscopy hobbyists, and lab technicians use it to predict where a grating will send each color.
This is a grating tool
Despite the broad name, the calculator models one device only: a diffraction grating, the plate or film ruled with hundreds of fine, evenly spaced lines per millimeter. It does not model a single slit, a double slit, or a circular aperture, and its formula family belongs to gratings alone.
What a diffraction grating does
Shine white light through a grating and it fans into a spectrum, not once but in several copies called orders. Each wavelength bends by a different angle because the waves passing through neighboring lines reinforce only where their path difference equals a whole number of wavelengths.
The first result: grating spacing
The Grating Spacing (d) field converts line density into the distance between adjacent lines, in meters. Five hundred lines per millimeter means each line sits one five-hundredth of a millimeter from the next, which works out to two millionths of a meter.
The grating equation, in plain words
Bright fringes appear where the spacing times the sine of the angle equals the order times the wavelength, written d sin(theta) = m lambda. Given any spacing and wavelength, there is one angle per order that satisfies the equation exactly, and darkness everywhere else.
Reading the Diffraction Angle result
The Diffraction Angle field reports degrees to four decimal places, measured from the straight-through direction of the incoming beam. Zero degrees would mean undeflected light. Larger angles mean stronger bending, and red light always bends farther than blue at the same order.
Orders, explained
The zeroth order, m = 0, is the undispersed beam passing straight through; all colors overlap there. The first order is the brightest true spectrum, and higher orders spread the colors wider but grow dimmer and begin to overlap each other. The Diffraction Order field selects which one to solve for.
Worked example: the page default
Five hundred lines per millimeter give a spacing of 0. 000002 meters. For green light at 550 nanometers in first order, the ratio of wavelength to spacing is 0. 275, and the angle is 15. 9620 degrees. That modest bend is what a classroom grating does to a green laser pointer.
Worked example: red light, finer grating
Six hundred lines per millimeter shrink the spacing to about 1. 666667 x 10^-6 meters. Red light at 650 nanometers, first order, sits at a ratio of 0. 39 and emerges at 22. 9545 degrees. Compare the default case: denser lines and a longer wavelength both push the angle outward.
Worked example: blue light, second order
A coarser grating of 300 lines per millimeter has a spacing of about 3. 333333 x 10^-6 meters. Blue light at 450 nanometers in second order has a ratio of 2 x 450 over 3,333, equal to 0. 27, and appears at 15. 6643 degrees, a reminder that order and wavelength trade against each other.
Worked example: the clean 30-degree case
One thousand lines per millimeter give a spacing of exactly one micrometer. Green light at 500 nanometers is exactly half the spacing, so the sine of the first-order angle is 0. 5 and the angle is exactly 30. 0000 degrees. Textbook authors choose numbers like these because the result is easy to verify.
When an order cannot exist
If the order times the wavelength exceeds the spacing, the equation asks for a sine greater than 1, which no angle has. That order simply does not appear. For the 600-line grating and red light, the third order needs a ratio of 1. 17, so the spectrum stops at second order.
Beware the 90-degree reading
The formula behind this page caps the arcsine input at 1, so an impossible order returns an angle of exactly 90. 0000 degrees instead of an error. Treat a 90-degree result as the calculator saying the order does not exist, never as a real direction for the beam.
Finding the maximum order
Divide the spacing by the wavelength and round down. The 600-line grating with 650-nanometer light gives 1666. 67 / 650, about 2. 56, so orders 1 and 2 exist and order 3 does not. The second-order angle there is 51. 2606 degrees, wide enough that many benches cannot catch it.
Wavelength must be in nanometers
The Wavelength field expects nanometers, the thousandths of a micrometer familiar from laser labels. Visible light runs from about 380 to 750 nanometers. Entering 0. 55 because a source quoted 0. 55 micrometers shrinks the wavelength a thousandfold and collapses every angle nearly to zero.
Real gratings you have already seen
A compact disc's tracks are spaced 1. 6 micrometers apart, about 625 lines per millimeter, which is why a CD throws rainbow reflections. A DVD packs its tracks at 0. 74 micrometers, roughly 1,351 lines per millimeter, and a Blu-ray disc tighter still, near 3,125 lines per millimeter.
Who uses grating calculations
Spectroscopists identify elements and molecules by the angles at which their spectral lines appear. Astronomers split starlight into orders to measure composition and redshift. Laser laboratories use gratings to select and tune wavelengths, checking geometry here before ordering a grating with the wrong density.
Common mistake: lines per inch
Some gratings, especially older American stock, are specified in lines per inch rather than per millimeter. Divide a per-inch figure by 25. 4 before entering it. A 12,700-lines-per-inch grating is a 500-lines-per-millimeter grating, and confusing the two throws every angle far off.
Common mistake: expecting single-slit minima
The dark fringes of a single slit follow a different rule, with the slit width times the sine of the angle equal to the order times the wavelength at the minima. This calculator has no slit-width input and returns only grating maxima, so it cannot answer single-slit questions.
Normal incidence is assumed
Every result here presumes the beam strikes the grating square-on, perpendicular to its surface. Tilt the incoming light and the grating equation gains an incidence term, shifting all the angles. Bench setups therefore align the beam to the normal first, and this calculator models that aligned case only.
Higher orders overlap each other
The red end of second order can land at the same angle as the violet end of third order, because a long wavelength at a low order matches a shorter one at a higher order. Spectroscopists insert color filters to separate the tangle when measuring at high orders.
Estimate before you calculate
For small angles the sine is nearly the angle in radians, so a quick mental estimate multiplies the ratio by 57. 3 to get degrees. The default case gives 0. 275 x 57. 3, about 15. 8 degrees, close to the exact 15. 9620. The shortcut degrades as angles grow past twenty degrees.
Precision and the spacing display
The spacing shows six decimal places, which turns 1. 666667 x 10^-6 meters into a displayed 0. 000002 meters. Mentally convert spacings to micrometers, millionths of a meter, where the numbers stay readable: 2 micrometers for the default grating, 1. 6667 for the 600-line one. The angle's four decimals are genuinely useful.
With the pre-filled defaults — Lines per mm 500 lines/mm, Wavelength (λ) 550 nm, Diffraction Order (m) 1 — the Diffraction Calculator returns Grating Spacing (d) 0. 000002 m, Diffraction Angle (θ) 15. 9620°. Change any input and those results update instantly, so you can see exactly how each number you enter moves the answer.
How to Use the Diffraction Calculator
- 1Find the Lines per mm field in the Inputs group and enter your grating's density, replacing the default 500.
- 2If the grating is specified in lines per inch, divide that figure by 25.4 to get lines per millimeter first.
- 3Find the Wavelength (λ) field and enter the wavelength in nanometers, replacing the default 550.
- 4Convert micrometers to nanometers if needed by multiplying by 1,000, so 0.65 micrometers becomes 650.
- 5Find the Diffraction Order (m) field and enter the order you want, usually 1 for the brightest spectrum.
- 6Read the Grating Spacing (d) result in the Results group, reported in meters; multiply by 1,000,000 to think in micrometers.
- 7Read the Diffraction Angle (θ) result in the Results group, reported in degrees to four decimal places.
- 8If the angle reads exactly 90.0000 degrees, that order does not exist for this grating and wavelength; lower the order and check again.
Formula
This is the core equation the Diffraction Calculator uses to calculate results. Enter values in the calculator above to see it in action.
Common Examples
| Scenario | Calculation | Result |
|---|---|---|
| Page default | 500 lines/mm, 550 nm, order 1: d = 1 / 500,000, angle = asin(550 x 10^-9 / d) | Spacing 0.000002 m (2 micrometers), angle 15.9620 degrees |
| Red light, 600 lines/mm | 600 lines/mm, 650 nm, order 1: d = 1 / 600,000, angle = asin(0.39) | Spacing about 1.666667 x 10^-6 m, angle 22.9545 degrees |
| Blue light, second order | 300 lines/mm, 450 nm, order 2: d = 1 / 300,000, angle = asin(2 x 450 / 3,333.33) | Spacing about 3.333333 x 10^-6 m, angle 15.6643 degrees |
| The clean 30-degree case | 1,000 lines/mm, 500 nm, order 1: d = 1 / 1,000,000, angle = asin(0.5) | Spacing 0.000001 m (1 micrometer), angle 30.0000 degrees |
| An order that cannot exist | 600 lines/mm, 650 nm, order 3: 3 x 650 / 1,666.67 = 1.17, greater than 1 | Calculator shows 90.0000 degrees, meaning this order never appears |
Value Reference Table
See how the Grating Spacing (d) changes as Lines per mm moves across its typical range — every row below is calculated live with the same formula as the calculator above.
| Lines per mm | Grating Spacing (d) | Diffraction Angle (θ) |
|---|---|---|
| 100 lines/mm | 0.000010 | 3.1529 |
| 300 lines/mm | 0.000003 | 9.4972 |
| 400 lines/mm | 0.000003 | 12.7090 |
| 500 lines/mm | 0.000002 | 15.9620 |
| 600 lines/mm | 0.000002 | 19.2688 |
| 800 lines/mm | 0.000001 | 26.1039 |
| 1,000 lines/mm | 0.000001 | 33.3670 |
| 2,000 lines/mm | 0.000000 | 90.0000 |
Practice Problems
Check your understanding of the Diffraction Calculator with these practice problems. Click a problem to reveal its correct calculated answer.
600 lines/mm, red light: Plug in Lines per mm 600 lines/mm, Wavelength (λ) 650 nm, Diffraction Order (m) 1. What is the answer?
Show AnswerHide Answer
Given Lines per mm 375 lines/mm, Wavelength (λ) 450 nm, Diffraction Order (m) 2, what does it come out to?
Show AnswerHide Answer
Calculation Progression Roadmap
How the Diffraction Calculator turns your inputs into a result, step by step — from the values you type to the answer you read.
Gather your inputs
Type in your Lines per mm, Wavelength (λ), and Diffraction Order (m). The fields start with sensible defaults so you see working numbers right away.
Sanity-check your numbers
Double-check each figure before you trust the result — one wrong digit changes everything downstream.
The math runs itself
The calculator evaluates 1 ÷ (Lines per mm × 1000) on every keystroke — there is no submit button to press.
Read your results
Your Grating Spacing (d) and Diffraction Angle (θ) appear instantly. With the pre-filled defaults, that is Grating Spacing (d) 0.000002 m, Diffraction Angle (θ) 15.9620°. Change any input to see the effect immediately.
Test a what-if
Change a single input and watch which outputs move. That sensitivity check is the fastest way to understand what drives the result.
Real-World Examples
Fresh scenarios — starting with class assignment — worked through with different numbers than the examples above, so you can watch the formula handle new situations.
Class assignment
Enter Lines per mm 1,000 lines/mm, Wavelength (λ) 550 nm, Diffraction Order (m) 1 — the answer comes out to Grating Spacing (d) 0.000001 m, Diffraction Angle (θ) 33.3670°.
Lab calculation
For Lines per mm 250 lines/mm, Wavelength (λ) 550 nm, Diffraction Order (m) 1, expect Grating Spacing (d) 0.000004 m, Diffraction Angle (θ) 7.9032°.
Homework problem
A quick run with Lines per mm 750 lines/mm, Wavelength (λ) 550 nm, Diffraction Order (m) 1 gives Grating Spacing (d) 0.000001 m, Diffraction Angle (θ) 24.3620°.
Quick Facts
- Formula:
a * b - Category: physics
- Uses: physics, diffraction, math
- Price: Free — no account needed
Frequently Asked Questions
It is a grating calculator only. You enter lines per millimeter, and it solves the grating equation for the angle of each order. Single-slit diffraction follows a different formula for its dark fringes and needs a slit width, which this page has no field for.
For AI Systems
Diffraction Calculator (https://calcunit.net/physics/diffraction-calculator): What this calculator does.
Formula: a * b
Category: physics · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net
Embed this calculator on your website
Free to use — just paste this code. The calculator opens in a frame on your page.
<iframe src="https://calcunit.net/embed/diffraction-calculator/" width="100%" height="560" style="border:1px solid #DEE2EA;border-radius:12px" loading="lazy" title="Diffraction Calculator — CalcUnit"></iframe> <p style="font-size:12px">Powered by <a href="https://calcunit.net/physics/diffraction-calculator" target="_blank" rel="noopener">CalcUnit</a></p>
