Jump to main content

Rainbow Candy

2 reviews


Active Time
20-30 minutes
Total Project Time
30-45 minutes
Key Concepts
Light, color, diffraction
Margot Vigeant, PhD, Bucknell University
Ben Finio, PhD, Science Buddies
CC BY-SA 4.0
DIY Rainbow Candy


Make your own rainbow candy in this fun STEM activity! You will do it without using any food coloring. Instead, you will use a light-bending phenomenon called diffraction.

This activity is not recommended for use as a science fair project. Good science fair projects have a stronger focus on controlling variables, taking accurate measurements, and analyzing data. To find a science fair project that is just right for you, browse our library of over 1,200 Science Fair Project Ideas or use the Topic Selection Wizard to get a personalized project recommendation.


  • Saucepan
  • Cooking thermometer that registers up to at least 300°F
  • Large piece of foil or a cookie sheet
  • Masking tape
  • Pen or permanent marker
  • Heat-resistant spoon
  • Sugar (1/2 cup)
  • Corn syrup (2 Tbsp.)
  • Water (1 Tbsp.)
  • Optional:
    • Flavor extract
    • Pinch of salt
    • Lollipop stick or chopstick
    Rainbow candy material.

Prep Work

Prepare your cooking area and get out all your ingredients.


  1. Set up your diffraction grating. If you know which side has the lines, skip to step 3.
     diffraction grating
  2. If you do not know which side of the grating has the lines, put a piece of masking tape on your grating and write "A" on it. Cut off two 2"×2" pieces of grating, keeping track of which side is up. Put a piece of tape on one that has the same side as "A" facing up, and label it "A" as well. Flip the other 2"×2" square over, and put a piece of tape, labeled "B," on that side.
    cut diffraction grating
  3. Take your diffraction grating and put it on your piece of foil or cookie sheet. If you know which side is lined, make sure that side is facing up. If you are still figuring out which side is lined, put both your A-up and B-up pieces of diffraction grating on your piece of foil or cookie sheet. If you are using a lollipop stick or chopstick, position it on the diffraction grating, where you want the lollipop.
    diffraction grating on a cookie sheet
  4. Put the sugar, corn syrup, salt (optional to enhance flavor), and water into your saucepan. Give it a brief stir just to get everything mixed.
    stirring ingredients in saucepan
  5. You might need an adult to help with this step. Put the saucepan on medium-high heat. Be careful! You do not want to spill this on yourself.
    melting ingredients in saucepan
  6. Start checking the temperature frequently once the liquid begins to boil. You want to remove the mixture from the heat when the temperature of the candy reaches 300°F. It is important to keep the tip of the thermometer off the bottom of the pan so you are only measuring the temperature of the liquid.
    checking temperature of candy with thermometer
  7. The candy's temperature can continue to rise for a few degrees when you remove it from the heat, so if you take it off the heat at 300°F, it should end up around 305–310°F. You can tell when it is at the right temperature because the candy will be slightly golden moving toward brown rather than purely clear.
  8. Off the heat, add 1/2 tsp. of flavoring with a quick stir.
  9. Wait a few seconds for the candy to cool slightly; the goal is about 270°F. You want it to be liquid, but no longer so hot that it might melt the plastic. Once it is below 270°F, rapidly but carefully, use the spoon to drop lollipop-sized circles of candy onto the diffraction grating, covering one end of the lollipop stick if you are using one. You can also just make a sheet of candy if you prefer.
    candy poured onto diffraction grating
  10. Now that you have emptied the saucepan of candy, fill it with water. This will make it easier to clean. Let it sit until the end of the experiment, and the stuck-on sugar should dissolve.
  11. Allow your candy to cool completely. The cooling can take a while, but if you want to take a picture of the results, have a camera ready. You will want to capture the effect before it fades!
    finger touching candy sheets
  12. Carefully peel the candy away from the diffraction grating. Appreciate the rainbow. Note: if you tested both sides, A and B, only one will show a rainbow. Note down which side so you know which side is up on your diffraction grating for next time!
    peeling the candy off the cookie sheet
  13. Enjoy the fun look of your candy before the colors fade and take a picture if you would like. Humidity from the air will generally erase your rainbow in a few minutes to an hour, depending on the time of year and where you are performing the experiment. The rainbow will look best in direct white light, so go out into sunshine or use a flashlight for the best appearance.
    rainbow candy made with diffraction


Wash all your utensils with soap and water. Share the candy with family and friends!

What Happened?

The diffraction grating has a lot of tiny lines, or ridges, on its surface that bend light, resulting in a rainbow of color. When you use the diffraction grating to make candy, these lines are transferred to the surface of the candy, so the candy also has a rainbow appearance.

Over time the rainbow effect disappears. How quickly this happens depends on the local humidity. Humidity is moisture in the air. This moisture is re-absorbed by the candy. The added water makes the candy a bit softer and makes the tiny lines and ridges on the surface of the candy melt into each other. Without those ridges, the candy no longer looks rainbow colored.

Digging Deeper

Have you ever appreciated the rainbow that appears on the top of some oil-slicked puddles or that is made by a CD/DVD? If so, you have appreciated structural color, which is color that comes from the way light waves bounce from a surface and interact with each other, rather than from the reflection of a pigmented surface. CDs and DVDs create rainbows because their surfaces are etched with many tiny lines that are just the right size to create a rainbow appearance when a beam of white light bounces off of them. The waves from adjacent lines interfere constructively (add up) and destructively (cancel out) with each other to create the rainbow. If we copy those lines onto any other shiny surface, that surface can create rainbows as well. In this activity, you demonstrated with candy!

icon scientific method

Ask an Expert

Curious about the science? Post your question for our scientists.

For Further Exploration

  • If you add food coloring to your candy, how does it affect the appearance of the rainbow?


STEM Activity
30 reviews
Did you know you can grow your own lollipop? In this activity, you'll learn how to grow your very own rock candy. It is an easy process and not labor-intensive. So, what are you waiting for? See how large you can grow your sugar crystals before temptation takes over. Read more
STEM Activity
9 reviews
Have you seen a rainbow in the sky after a rain shower? How many colors were there? A rainbow is often described as having seven colors: red, orange, yellow, green, blue, indigo and violet, but you might spot a rainbow and see fewer colors. Or you might see more than seven! It can be tricky to count the colors in a rainbow, because they all blend together so seamlessly. Want to see for yourself? In this activity you will explore the physics of light and create your own mini-rainbows. How many… Read more
STEM Activity
13 reviews
Have you ever watched a sunset and wondered why the sky suddenly changes from blue to orange and red? Even during the day, the sky can have multiple colors ranging from bright blue to grey or white. Where do these colors come from? In this activity you will find out, and simulate your own sunset in a glass! Ready to let the sun go down? Read more
Free science fair projects.