Dung beetles get shit done. Even in the dead of night, these poop-eating creatures can roll balls of fecal matter in a surprisingly straight line like it's the easiest task in the world. But don't be fooled; dung beetles have an advanced internal GPS system that guides them at night. Now, scientists have finally figured out how that navigation system works.

Dung beetles eat poop to survive; it's just their way. So when a beetle finds a fresh pile of animal poop, it slices off a piece and shapes it into a ball that it rolls away from other hungry beetles. That's why being able to roll these balls in a straight line is so important; it makes getting away from other beetles quickly a lot easier. This behavior has fascinated researchers for a long time, but until recently scientists only knew that beetles used cues in the sky — the Sun, the Moon, or even the Milky Way — to navigate. This week's study, published in Proceedings of the National Academy of Sciences, digs deeper to show exactly how the beetle's brain cells use celestial cues to get around.

Dung beetles have to roll poop balls away from other hungry beetles

In the study, researchers gave balls of poop to nocturnal and daytime-active dung beetles in South Africa. Then, they used mirrors to change the perceived position of the Sun or the Moon when the beetles started to roll the balls. When the scientists did this during the day, they found that they were able to trick both the nocturnal and daytime-active beetles into going the wrong way — meaning that all the beetles used the Sun to navigate.

(Jochen Smolka / Lund University)

But at night, nocturnal beetles couldn't be tricked. Unlike the daytime-active beetles, they didn't rely solely on the Moon to navigate. Instead, they used polarized light — a kind of light that humans can't see — generated by moonlight scattering in the atmosphere to orient themselves. So the mirrors didn't faze them.

The compass neurons that guide nocturnal beetles can switch their focus

Back in the lab, the researchers looked at the beetles' brain cells to find out how they managed this feat. They found that the compass neurons that guide nocturnal beetles are able to change which cues they focus on based on the environmental conditions that the insects encounter. Daytime-active species aren't nearly as adaptable.

Given how the moon operates, it makes sense that nocturnal beetles wouldn't rely solely on the Earth's satellite to get around. Nocturnal species have to be able to navigate even when the Moon is nothing but a small crescent, hidden by clouds. When that happens, they can use polarized light to direct them. And when the Moon and polarized light aren't available — this happens when the Moon is lower than the horizon — the beetles orient themselves using the Milky Way, according to previous research.

The areas of the brain that act as a compass can be found in many other insects, so the findings are probably relevant to other species as well. But until that's confirmed, this study shows that nocturnal dung beetles are great navigators — even when they're rolling balls of poop away from their rivals.