Want to impress your friends in the midst of a fireworks display? Wow them with your knowledge of basic chemistry and let them in on the secrets to the rainbow beauty of the night sky on the Fourth of July.
According to EarthSky, small pellets, charmingly named “stars,” are the key to the fireworks’s colors. The stars are filled with different combinations of metal salts that each add a bright color to the firework when it explodes.
Different chemical elements correspond with different colors: strontium carbonate for red, calcium chloride for orange, sodium nitrate for yellow, barium chloride for green, and copper chloride for blue. Purple fireworks are created much like you might create purple paint—by mixing red and blue.
LiveScience explains that when you light the fuse on the outside of the fireworks’s thick tube, the flame ignites a pouch of black powder inside known as the lift charge, which causes the shell containing the stars to catapult into the air. As it rises, a time-delay fuse begins to burn within it and, by the time it reaches its maximum height, the shell bursts, causing the stars inside to color each strand of the explosion.
Paul Nicholas Worsey, fireworks expert and professor of mining and nuclear engineering at the University of Missouri at Rolla, told LiveScience that red and green are the easiest colors to create, while blue is more difficult. Worsey says gold is best if you want your firework to keep its color for a long time, maybe even until it hits the ground.
The trick behind those especially crowd-pleasing fireworks that change color after they explode is simple: The stars are coated in multiple metal salts. Once you see the firework’s second color, that means the stars burned through their outer layer and reached a different metal salt—kind of like licking a Gobstopper.
For another way to impress your friends this fireworks season, learn the names of these 10 fireworks effects so you can call them out as they burst.
A version of this story ran in 2019; it has been updated for 2023.
This article was originally published on www.mentalfloss.com as How Do Fireworks Get Their Colors?.