Independence Day is upon us, and that means grilling, s’mores, and plenty of good old-fashioned explosions. In other words: lots and lots of chemistry. For a breakdown of exactly how our favorite pyrotechnics work, check out the videos below from the American Chemical Society.

As a professor emeritus at Washington College, John Conkling may have one of the coolest jobs ever: experimenting with explosive chemicals and teaching his students to do the same. As Conkling explains in the video above, every explosion in a fireworks display is the result of two separate chemical reactions: one to launch the device into the air, and another that produces all those ooh- and ahh-inspiring sparkles.

The sparkles themselves are tiny flecks of metal, burning up in midair. Getting them to explode is easy, Conkling says. But getting them to explode blue? That’s a science

While sparklers may look like miniature, handheld fireworks, the mechanics are quite different. They do rely on fuel and oxidation like fireworks, but rather than just going off in midair, those reactions have to occur safely on a metal stick. Sparklers’ reactive chemicals are mixed with a binder that keeps the fire in place and slows it down, so you can enjoy your tiny explosions for just a little longer.