It seems kind of magical, doesn’t it? As summer draws nearer and the days grow longer, it’s only natural to start daydreaming of summer barbecues, picnics and downtime. And the glow of a firefly is a requisite symbol of the lazy, hazy days and nights of summer. To be honest, I’d never really thought about it myself, but the answer is positively fascinating.

So How Do Fireflies Glow?

Turns out it’s not quite so magical after all, since it’s the product of a complex chemical reaction going on inside their bodies. You see, fireflies contain a chemical in their abdomen called luciferin. When that chemical combines with oxygen and with an enzyme called luciferase, the ensuing chemical reaction causes their abdomen to light up. This light is referred to as bioluminescence, which is when a chemical light is produced by a reaction within a living organism. Most commonly seen on dry land in the glow of a firefly, bioluminescence is actually far more common under the sea in many species of fungi, fish and other marine wildlife. Bioluminescence is a “cold light”— it doesn’t produce any heat, like the light from a light bulb, for instance. And it’s a good thing too, because if a firefly produced heat along with its glow, it wouldn’t be able to survive.

So Why Do Fireflies Glow in the First Place?

The answer to that is the same as the answer to the question of why some men wear so much darn cologne. To attract the ladies, of course! (But far more successfully than the men with the cologne.) Most of the time, at dusk, when you see fireflies buzzing around flashing lights all around you, they’re actually male fireflies doing most of the flashing. That’s because they’re trying to "show off" for the ladies of their own species. There are more than 2,000 species of firefly. A male firefly will light up its abdomen at a particular rate or wavelength, and when a female firefly sees a male from her own species shining in that particular way, she’ll respond with her own light. Hence baby fireflies are conceived.

Another reason fireflies glow (and this one not quite as romantic) is to lure prey. Some females will glow to lure a male to her and then — chomp! — he becomes dinner.

The final reason that fireflies glow is to deter predators. Fireflies are filled with chemicals called lucibufagins, which is hard to say and even harder to swallow — they taste terrible. When a predator tastes a firefly, it learns to associate the glow with the bad taste. So the firefly’s glow actually warns would-be predators to stay away.

There you have it, folks. Something so simple and magical as a lightning bug’s glow broken down into all its not-so-magical component parts. Then again, that makes it kind of magical, right? (Check out the video below of fireflies —accompanied by cricket song — in a soybean field.)