Stories evolve. As they are told and retold to new audiences, they accumulate changes in plot, characters, and settings. They behave a lot like living organisms, which build up mutations in the genes that they pass to successive generations.

This is more than a metaphor. It means that scientists can reconstruct the relationships between versions of a story using the same tools that evolutionary biologists use to study species. They can compare different versions of the same tale and draw family trees—phylogenies—that unite them. They can even reconstruct the last common ancestor of a group of stories.

In 2013, Jamie Tehrani from Durham University did this for Little Red Riding Hood, charting the relationships between 58 different versions of the tale. In some, a huntsman rescues the girl; in others, she does it herself. But all these iterations could be traced back to a single origin, 2,000 years ago, somewhere between Europe and the Middle East. And East Asian versions (with several girls, and a tiger or leopard in lieu of wolf) probably derived from these European ancestors.

That project stoked Tehrani's interest, and so he teamed up with Sara Graça da Silva, who studies intersections between evolution and literature, to piece together the origins of a wider corpus of folktales. The duo relied on the Aarne Thompson Uther Index—an immense catalogue that classifies folktales into over 2,000 tiered categories. (For example, Tales of Magic (300-749) contains Supernatural Adversaries (300-399), which contains Little Red Riding Hood (333), Rapunzel (310), and more amusing titles like Godfather Death (332) and Magnet Mountain Attracts Everything (322).

Tehrani and da Silva recorded the presence of each Tales of Magic to 50 Indo-European populations, and used these maps to reconstruct the stories' evolutionary relationships. They were successful for 76 of the 275 tales, tracing their ancestries back by hundreds or thousands of years. These results vindicate a view espoused by no less a teller of stories than Wilhelm Grimm—half of the fraternal duo whose names are almost synonymous with fairy tales. He and his brother Jacob were assembling German peasant tales at a time of great advances in linguistics. Researchers were unmasking the commonalities between Indo-European languages (which include English, Spanish, Hindi, Russian, and German), and positing that those tongues shared a common ancestor. In 1884, the Grimms suggested that the same applied to oral traditions like folktales. Those they compiled were part of a grand cultural tradition that stretched from Scandinavia to South Asia, and many were probably thousands of years old.

Many folklorists disagreed. Some have claimed that many classic fairy tales are recent inventions that followed the advent of mass-printed literature. Others noted that human stories, unlike human genes, aren't just passed down vertically through generations, but horizontally within generations. “They’re passed across societies through trade, exchange, migration, and conquest,” says Tehrani. “The consensus was that these processes would have destroyed any deep signatures of descent from ancient ancestral populations.”

Not so. Tehrani and da Silva found that although neighboring cultures can easily exchange stories, they also often reject the tales of their neighbors. Several stories were less likely to appear in one population if they were told within an adjacent one.

Meanwhile, a quarter of the Tales of Magic showed clear signatures of shared descent from ancient ancestors. “Most people would assume that folktales are rapidly changing and easily exchanged between social groups,” says Simon Greenhill from the Australian National University. “But this shows that many tales are actually surprisingly stable over time and seem to track population history well.” Similarly, a recent study found that flood “myths” among Aboriginal Australians can be traced back to real sea level rises 7,000 years ago.

Many of the Tales of Magic were similarly ancient, as the Grimms suggested. Beauty and the Beast and Rumpelstiltskin were first written down in the 17th and 18th centuries respectively, but they are actually between 2,500 and 6,000 years old—not quite tales as old as time, but perhaps as old as wheels and writing.

The Smith and the Devil is probably 6,000 years old, too. In this story, a crafty blacksmith sells his soul to an evil supernatural entity in exchange for awesome smithing powers, which he then uses to leash the entity to an immovable object. The basic tale has been adapted in everything from Faust to blues lore, but the most ancient version, involving the blacksmith, comes from the Bronze Age! It predates the last common ancestor of all Indo-European languages. “It's constantly being updated and recycled, but it's older than Christianity,” says Tehrani.

This result might help to settle a debate about the origins of Indo-European languages. It rules out the idea that these tongues originated among Neolithic farmers, who lived 9,000 years ago in what is now modern Turkey. After all, how could these people, who hadn’t invented metallurgy, have concocted a story where the hero is a blacksmith? A rival hypothesis becomes far more likely: Indo-European languages emerged 5,000 to 6,000 years ago among pastoralists from the Russian steppes, who knew how to work metal.

“We think this is the start of a much bigger project using oral traditions and storytelling as windows into the lives of our ancestors,” says Tehrani.

He now wants to understand why some tales track well with human history but others don’t. Are some plot elements or motifs more stable than others? “There wasn't anything obvious, no religious or supernatural dimension that stood out, and no gender norms or aspects that might be particular to particular societies,” he says. “But it needs a much more detailed analysis, bringing in historians, ethnographers, and other scholars.”

“Folktales are often disregarded as lesser forms of literature, but they’re valuable sources of information on cultural history,” adds da Silva. “Despite being fictitious, they work as simulations of reality.”

In other words, by understanding our stories, we understand ourselves.