Behind the scenes of the dazzling light shows that make spectators "Ooh!" and "Ahh!" on the Fourth of July, are carefully crafted fireworks. Whether red, white and blue fountains or bursts of purple sparks, each firework is packed with just the right mix of chemicals to create these colorful lights.
Inside each firework is something called an aerial shell — a tube that contains gunpowder and dozens of small modules called "stars," which measure about 1 to 1.5 inches (3 to 4 centimeters) in diameter, according to the American Chemical Society (ACA). These stars hold fuel, an oxidizing agent, a binder and metal salts or metal oxides — the source of the firework's hues. A time-delay fuse ignites the gunpowder and bursts the aerial shell once the firework is midair, causing the stars to scatter and explode far above the ground, producing a shower of light and color.
Once exposed to fire, the stars' fuel and oxidizing agents generate intense heat very rapidly, activating the metal-containing colorants. When heated, atoms in the metal compounds absorb energy, causing their electrons to rearrange from their lowest energy state to a higher "excited" state. As the electrons plummet back down to their lower energy state, the excess energy gets emitted as light.
Related: 5 dazzling facts about fireworks
Each chemical element releases a different amount of energy, and this energy is what determines the color or wavelength of the light that is emitted.
For instance, when sodium nitrate is heated, electrons in the sodium atoms absorb the energy and get excited. As the electrons come down from the high, they release their energy, about 200 kilojoules per mole (a unit of measurement for chemical substances) or the energy of yellow light, according to the website of the University of Wisconsin-Madison chemistry professor Bassam Z. Shakhashiri.
The recipe that creates blue includes varying amounts of copper chloride compounds. Red comes from strontium salts and lithium salts, and the brightest red is emitted by strontium carbonate, the ACA explained on their website.
Just like paints, secondary colors are made by combining the ingredients of their primary-color relatives. A mixture of blue-producing copper compounds and red-producing strontium compounds results in purple light, the ACA reported.
Fireworks have been around for hundreds of years, and over the centuries experts known as pyrotechnic chemists have developed combinations of chemicals that not only produce breathtaking visual displays in a range of shapes and colors, but which are stable and can be used safely, chemist John Conkling, a fireworks expert at Washington College in Maryland, told the ACA.
Original article on Live Science.
Editor's Note: This article was updated on July 3, 2017, by Live Science's Mindy Weisberger.