A Fourth of July celebration wouldn't be complete without big bursts of colorful explosives lighting up the summer sky at dusk.
And while you're taking in the big show, you might be wondering: How exactly do fireworks work? How is it that there are fabulous, colorful explosions in the sky that can be shaped into anything from smiley faces to hearts?
We're here to fill you in. The short answer? It's a whole lot of chemical reactions happening at once.
It all boils down to an explosion
Simply, a firework is a container — typically a tube or a ball shape — that holds explosives hitched up to a time-delay fuse.
The explosives are where the fun happens. They typically contain little balls of colored explosives called "stars." These are filled with colors that blaze brightly in the sky, but after only a certain amount of time has passed. This is why fireworks can get up high in the sky before exploding into brilliance.
When the fuse gets low enough in the firework, it reacts with a bursting charge, which in turn lights the explosives that will disperse the stars. The ignited explosive creates a high-pressure gas that blows the colorful stars outward.
Here's what that looks like:
Mike Nudelman/Business Insider
Chemical reactions create the colors
The colors that sparkle in the sky are chemical reactions happening right before your eyes.
Inside every star is an oxidizing agent, fuel, a certain metal that acts as the color, and a binder that holds it all together. The fuel and oxidizing agent are the parts responsible for the intense heat and gas of the explosion, according to the American Chemical Society.
But the coolest part is the metals that act as the colors. Some just heat up and cycle through red, orange, yellow, and white, depending on how hot the explosion is. The heat makes the atoms inside the wire move faster and faster, causing the atoms to bump into each other more, which gives off light. If you can control the temperature of the firework, then you can pick the exact time you want that firework to be a certain color.
Related: Best recipes this July 4
But more commonly, fireworks create light by letting off specific colors that depend based on what metals you add to the mix.
For a complete display, fireworks often mix different metals and metal salts to give you the vibrant, multicolored effects. Calcium salts will burn orange, while sodium salts will burn yellow.
And if you burn copper, it'll give off light that's blue-green.
The shapes are the product of some careful organization
Fascinated by that smiley face or oddly lopsided heart in a firework display? It's nothing more than some careful organization of the stars. If they're just spread randomly, they'll expand out evenly through the sky once they explode.
But, because the explosion will push the stars out in a predictable trajectory, it is possible to organize the stars in a particular pattern on the cardboard cylinder on the outside of the firework. This will create specific shapes.
The big, booming sound comes from expanding gases
No fireworks display would be complete without the ear-shattering booms that freak out dogs and resonate in our chests. That's caused by a sonic boom that happens as the gases inside the firework expand faster than the speed of sound.
Throw all of these explosives and awesome chemistry together and you get this:
Related: Cute puppies celebrate July 4:
Jennifer Welsh contributed to an earlier version of this article.