There's a stunning amount of chemistry that goes into your Fourth of July fireworks

As you gear up to watch fireworks this Fourth of July, you might wonder: How exactly do fireworks work?

How is it that there are fabulous, colourful 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 coloured explosives called “stars.” These are filled with colours 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 colourful stars outward.

Here’s what that looks like:

The colours

The colours 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 colour, 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 colours. Some just heat up and cycle through red, orange, yellow, and white colours, 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 colour.

But more commonly, fireworks create light by letting off specific colours 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 will 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 organisation of the stars. If they’re just spread randomly, they will 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 organise 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.

NOW WATCH: People with these personality traits have more and better sex

NOW WATCH: Briefing videos

Business Insider Emails & Alerts

Site highlights each day to your inbox.

Follow Business Insider Australia on Facebook, Twitter, LinkedIn, and Instagram.