Omni calculator
Last updated:

Diffraction Grating Calculator

Table of contents

What is diffraction?What is diffraction grating?Diffraction grating equationFAQs

This diffraction grating calculator will help you find out what happens when the light hits a structure with multiple openings (slits or rulings). The light ray gets diffracted in various directions. Our tool determines the paths that light takes with the use of a simple diffraction grating formula.

💡 Keep reading to learn how diffraction works, or take a look at the Snell's law calculator if you're interested in other optics phenomena.

What is diffraction?

Diffraction is a wave phenomenon that happens when a light ray hits an obstacle or a slit. After the light has traveled through the aperture, it changes its direction, what usually results in the wave spreading out.

waves creating a diffraction pattern

What is diffraction grating?

Diffraction grating happens when the light hits an obstacle with uniformly distributed apertures. Then, the rays get diffracted — each of them goes in a slightly different direction.

The effects of diffraction are only visible if the spacing between apertures is larger than the wavelength of the incident ray.

Diffraction grating equation

diffraction grating diagram

If the incident light ray is perpendicular to the grating, you can use the following diffraction grating equation to find the directions in which the rays are diffracted:

a×λ=d×sin(θa)a \times \lambda = d \times \sin(\theta_a)


  • λλ is the wavelength of the incident ray;
  • dd is the grating spacing;
  • θa\theta_a is the angle between the initial and diffracted direction of light for ray aa; and
  • aa is a positive non-zero integer that represents the order of the diffracted image. a=1,2,3...a = 1, 2, 3...

If the incident ray meets the apertures at an angle θo\theta_o, you also need to include it in your calculations:

a×λ=d×(sin(θo)+sin(θa))a \times \lambda = d \times \left(\sin(\theta_o) + \sin(\theta_a)\right)

For example, for the ray incident at the angle of 30° (sin30=0.5\sin 30^\circ = 0.5), the equations for first three diffracted images will have the following form:

You can calculate the directions manually or use this diffraction grating calculator to do it for you!

λ=d×(0.5+sin(θ1))2λ=d×(0.5+sin(θ2))3λ=d×(0.5+sin(θ3))\begin{aligned} λ &= d \times \left(0.5 + \sin(\theta_1)\right) \\ 2λ &= d \times \left(0.5 + \sin(\theta_2)\right) \\ 3λ &= d \times \left(0.5 + \sin(\theta_3)\right) \end{aligned}

What is the diffraction of light?

Diffraction is the phenomenon of light bending as it passes around an edge or through a slit. Diffraction only occurs when the size of the obstacle is of the same order of magnitude as the incident wave. Once through the slit, the bent waves can combine (interfere), strengthening or weakening the waves. Diffraction depends on the slit size and the wavelength.

Which are real life examples of diffraction?

In everyday life, you can observe the effects of diffraction as, for example:

  • A rainbow pattern on a CD or DVD;
  • Holograms;
  • Solar and lunar coronas;
  • The red color of the sun at sunset;
  • Bending of light at the corners of the door;
  • Sound propagation despite the presence of obstacles, or
  • Water waves bent around a fixed object.

How does a diffraction grating works?

A diffraction grating is an optical element that helps you to divide white light into the different colors associated with a given wavelength. The simplest type of grating is one that has a large number of parallel, evenly-spaced slits. When you shine white light onto them, it will diffract. You will see each color deflected at a different angle and notice that, in fact, white light is made up of many colors.

At what angle is the second diffracted image for 560-nm light?

Assuming that the grating density is 1,000 lines/mm, λ = 560 nm, and incident angle θa = 30°, the second order of the images will occur at 38.32°.

  1. Calculate grating spacing:
    d = 10-3 m/1 × 10-3 = 10-6 m.
  2. Use the formula: a × λ = d × sinθa.
  3. Insert data:
    2 × 560 × 10-9 m = 10-6 m × sin(30°) = 38.32°.

What is the wavelength if second-order image appears at 30°?

If the grating density is 4,000 lines/mm, the wavelength would be 625 nm. To calculate it:

  1. Find grating spacing:
    d = 10-3 m/4 × 10-3 = 2.5 × 10-6 m.
  2. Modify diffraction grating equation: λ = (d × sinθa)/a.
  3. Enter data:
    λ = (2.5 × 10-6 m × sin(30°))/2
    = (2.5 × 10-6 m × 0.5)/2
    = 0.625 × 10-6 m = 625 nm

Which is an everyday example of a diffraction grating?

CD, the diffraction grating on the surface of a mirrored CD, is formed by pits evenly spaced in rows of the same width and equal distance. The result is the familiar rainbow pattern you see when looking at the disc.

Light and grating properties

Diffracted images

Check out 28 similar optics and light calculators 🔍
Angular resolutionAperture areaBinoculars range...25 more