Spencer Platt / Getty Images
How is it that there are fabulous, colorful explosions in the sky that come in different shapes and sizes?
Well, we're here to help you out. The short answer: It's a whole lot of chemical reactions happening all at once.
The 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 only after 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
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 are the metals that act as the colors. Some just heat up and cycle through red, orange, yellow, and white colors, depending 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.
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 shape
Fascinated by that smiley face or oddly lopsided heart in the 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 sound
No fireworks display would be complete without the ear-shattering booms that freak out dogs and resonate in our chest. That's caused by a sonic boom that happens as the gasses inside the firework expand faster than the speed of sound.
Throw all these explosives and awesome chemistry together and you get this:
Jennifer Welsh contributed to an earlier version of this article.