Diffraction Grating Calculator

Diffraction angle (degrees)—
Line spacing (micrometres)—
Highest visible order—

How Diffraction Grating Calculator is calculated: d × sin θ = m × λ, with d = 1 ÷ lines per unit length

What does a Diffraction Grating do?

A diffraction grating calculator is a free online tool that finds the angle at which light of a given wavelength diffracts from a grating, and the highest order that can appear. It uses the grating equation d sin θ = m λ, where d is the spacing between lines and m is the order. It gives the answer instantly as you type, with the main result shown first and the supporting figures underneath, so you can check the headline number and the working behind it in one glance.

It is used by Class 12 and college optics students, teachers running the grating experiment, and spectroscopy learners. If you are working through a set of problems, a distance calculator is often the next step once this answer is in hand, because the two quantities feed into each other.

To use it, enter the number of lines per millimetre, the wavelength in nanometres, and the order number. The calculator runs entirely in your browser: nothing you type is uploaded, stored, or shared, and there is no sign-up. You can change any value and the results update at once, which makes it easy to test what happens when one input moves.

The Diffraction Grating formula, step by step

A diffraction grating is a plate ruled with thousands of fine parallel lines. Light passing through it spreads into a spectrum, with bright lines at angles set by the grating equation: the line spacing times the sine of the angle equals the order times the wavelength. The zeroth order goes straight through, the first order bends a little, and higher orders bend further, until the sine would exceed 1 and no more orders can appear. The formula the calculator uses is: d × sin θ = m × λ, with d = 1 ÷ lines per unit length. Every symbol in that formula has one meaning and one unit, and keeping the units straight is most of the work in getting a right answer.

By hand, the steps are: divide 1 by the lines per millimetre to get the spacing, multiply the order by the wavelength, divide by the spacing, and take the inverse sine for the angle. The calculator does the same steps in the same order, so a hand check on one example should land on the same number the page shows, allowing for the rounding in the display.

Lines go in per millimetre and wavelength in nanometres, and the calculator converts both to the same unit internally. A wavelength in micrometres by mistake is a thousand times too large and gives a sine above 1, which the calculator reports as no angle. The calculator is an estimate in the sense that it trusts the numbers you enter: it cannot tell whether a measurement was read correctly, so a wrong input gives a wrong-looking answer with no warning. Always check the units before trusting a result.

One more check: the formula above is the one the page uses, so a textbook that writes it differently is usually just rearranging the same relation or using different symbols. Match the symbols by their meaning, not by their shape, and the numbers will agree. If your book gives the answer in different units, convert at the end rather than in the middle, so a conversion slip cannot hide inside the working.

More lines per millimetre means a bigger angle

The line spacing is the reciprocal of the lines per millimetre, and it is the number that sets the angle. A grating with 500 lines per millimetre has a spacing of 2 micrometres, while one with 1000 lines per millimetre has a spacing of 1 micrometre. More lines means a smaller spacing, and a smaller spacing means a larger diffraction angle for the same wavelength.

The order number counts the bright lines outward from the centre: order 0 is straight ahead, order 1 is the first bright line to each side, and so on. Higher orders are further out and dimmer, and they stop when the order times the wavelength exceeds the spacing, because the sine of an angle can never be more than 1.

Red light diffracts more than violet light because its wavelength is longer: about 700 nanometres against 400. That is why a grating spreads white light into a rainbow with red on the outside. If your angle for red comes out smaller than for violet, the wavelengths are swapped.

A worked example

Take this example: 500 /mm, 550 nm, 1 . A grating has 500 lines per millimetre, the light has a wavelength of 550 nanometres, and we want the first order. Put those numbers into the calculator and it returns Diffraction angle (degrees) 15.96 ; Line spacing (micrometres) 2 ; Highest visible order 3 .

Working it through by hand: d = 1 ÷ 500 = 0.002 mm = 2 µm; sin θ = 1 × 550 ÷ 2000 = 0.275, so θ = 15.96°; the highest order is 2000 ÷ 550 = 3. The hand result matches the calculator exactly, which is the point of the check: if your own working gives a different number, one of the inputs was typed in the wrong unit or the wrong box.

Try a second set to see how the answer moves: the second order for the same grating and wavelength. sin θ = 2 × 550 ÷ 2000 = 0.55, so θ = 33.37°, further out than the first order as expected Changing one input at a time and watching the result is the fastest way to build a feel for the formula, and it is how most students spot a typing error before it reaches their homework.

Who uses a Diffraction Grating and why

The first group is students. A student with a 500 lines per millimetre grating and green light of 550 nanometres finds the first-order angle is about 16 degrees.

The second is teachers and tutors. A teacher checks how many orders a grating can show before the sine exceeds 1, to plan which lines students should be able to see. A energy converter is a natural companion here, since lessons often pair the two quantities in the same problem set.

The third is anyone doing practical work. A spectroscopy learner works out the angle for a known spectral line to calibrate a spectrometer before measuring an unknown source. None of these uses needs an account or an install: the page opens, the numbers go in, and the answer is there.

Exam and homework use is the common thread across all three groups. A calculator gives the number, but the marks come from the working: write the formula, substitute the values with units, and then the answer. A bare number with no working earns little credit even when it is right, while a shown method with one small slip usually earns most of the marks.

Diffraction Grating Calculator vs Velocity Calculator

A velocity calculator answers a different question: it finds speed from distance and time, while this page finds an angle from a spacing and a wavelength, which is a different kind of geometry.. The two tools look similar because they share inputs, but they solve for different unknowns, and picking the wrong one is the most common source of confusion between them.

Use this Diffraction Grating when the quantity you need is the one named in the title above. Use the Velocity Calculator when your unknown is the one it is named for instead. If a problem gives you the answer this page produces and asks for something else, that something else is usually the job of the companion tool.

In practice the two are used back to back: work out the first quantity here, then carry it into the second tool as an input. Keeping the chain in that order, and writing each intermediate answer down, stops small rounding slips from growing into a wrong final answer.

Common mistakes with a Diffraction Grating

The first mistake is using the lines per millimetre as the spacing itself, instead of taking its reciprocal.

The second is entering the wavelength in micrometres instead of nanometres, which makes the sine a thousand times too large.

The third is forgetting that the highest order is limited: asking for order 5 when only 3 exist gives no angle, not a wrong angle. A quick habit that catches all three: work one example by hand, compare it with the calculator, and only then trust the page for the rest of the set.

How to use this Diffraction Grating

Step one, enter the number of lines per millimetre, the wavelength in nanometres, and the order number. Step two, check the units beside each box match the units in your problem. Step three, read the main result at the top of the results box, then the supporting figures below it.

For the most accurate results, use the most precise inputs you have, and keep the same unit system all the way through a problem: mixing centimetres with metres, or milliamps with amps, is the single biggest cause of answers that are out by a factor of ten or a hundred. A quick check: 500 lines/mm and 550 nm light give a first-order angle near 16 degrees and a maximum order of 3.

The calculator is free, works on a phone or a computer, and needs no sign-up. Everything runs in your browser, so your numbers never leave your device, and closing the page leaves nothing behind.

If the answer looks wrong, change one input at a time and watch which one moves the result. A result that jumps by a factor of ten usually means a unit slipped, centimetres for metres or grams for kilograms, while a result that barely moves when an input changes usually means that input matters less than expected, often because it sits under a square root. Both patterns are worth knowing before an exam.

Frequently Asked Questions

The formula is d × sin θ = m × λ, with d = 1 ÷ lines per unit length. A diffraction grating is a plate ruled with thousands of fine parallel lines. Light passing through it spreads into a spectrum, with bright lines at angles set by the grating equation: the line spacing times the sine of the angle equals the order times the wavelength. The zeroth order goes straight through, the first order bends a little, and higher orders bend further, until the sine would exceed 1 and no more orders can appear. Put the values in with matching units and the calculator applies the formula directly, with no hidden adjustments.

The grating equation is d times sin θ equals m times λ, where d is the spacing between the lines, θ is the diffraction angle, m is the order number (0, 1, 2, and so on), and λ is the wavelength. The spacing is 1 divided by the number of lines per unit length. Bright lines appear only where this equation holds.

The angle is Diffraction angle (degrees) 15.96 ; Line spacing (micrometres) 2 ; Highest visible order 3 . The spacing is 1 divided by 500 lines per millimetre, which is 2 micrometres or 2000 nanometres, so sin θ is 550 divided by 2000, which is 0.275, and the inverse sine is about 16 degrees.

Each wavelength satisfies the grating equation at a different angle, because the angle depends on the wavelength. Violet light, around 400 nanometres, bends least and red light, around 700 nanometres, bends most, so the colours fan out into a spectrum with red on the outside. A prism does the same thing by refraction, while a grating does it by diffraction.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.