Birds are the only dinosaurs left. That might seem strange. A pigeon or a penguin doesn’t look much like a Tyrannosaurus. But the connection is still there, all the way down to the bone. About 150 million years ago, in the Jurassic, the first birds evolved from small, feathery, raptor-like dinosaurs, becoming another branch on the dinosaur family tree. For more than 80 million years, birds of all sorts flourished, from loon-like swimmers with teeth to beaked birds that carried streamer-like feathers as they flew.

With hindsight, birds can be categorized as avian dinosaurs and all the other sorts—from Stegosaurus to Brontosaurus—are non-avian dinosaurs. The entire reason paleontologists make that split is because of a catastrophe that struck 66 million years ago. An asteroid more than 6 miles across struck what’s now the Yucatan Peninsula, triggering the fifth mass extinction in the world’s history. Some of the debris thrown into the atmosphere returned to Earth, the friction turning the air into an oven and sparking forest fires as it landed all over the world. Then the intensity of the heat pulse gave way to a prolonged impact winter, the sky blotted out by soot and ash as temperatures fell. All told, more than 75 percent of species known from the end of the Cretaceous period, 66 million years ago, didn’t make it to the following Paleogene period. The geologic break between the two is called the K-Pg boundary, and beaked birds were the only dinosaurs to survive the disaster.

“There has been a lot of discussion about what enabled modern-type birds to survive the K-Pg extinction while other birds groups, non-avian dinosaurs, and even pterosaurs perished,” says Royal BC Museum paleontologist Derek Larson. The end of the Cretaceous boasted an entire array of birds and bird-like reptiles. But of these groups, it was only the beaked birds that survived. The happenstances of evolution had given birds a lucky break, the key events set in motion long before the asteroid struck.

All living birds have toothless beaks, but this wasn’t always so. The very first bird, the 150 million-year-old Archaeopteryx, initially confounded 19th century naturalists because it had teeth. For tens of millions of years after Archaeopteryx, toothed birds continued to thrive and evolve alongside their dinosaurian relatives. And some of these toothed birds eventually lost their teeth, plucking up their meals with toothless beaks instead.

The question is what evolutionary pressures pushed birds to lose teeth when teeth seem so useful. Given that most birds fly, adaptation to the air seemed like a possibility. “Older hypotheses focused on the idea of weight reduction for flight,” says University of Texas at Austin paleontologist Grace Musser, but the discovery that some toothed birds were strong fliers has led researchers back to the drawing board.

Rather than flight, food might have given birds an evolutionary nudge towards toothless beaks as ancient avians thrived among other dinosaurs. Paleontologists have noticed that some dinosaur groups, including birds, evolved beaks and lost teeth as they became more herbivorous. While the earliest birds had teeth to nab insects and other small morsels, some bird lineages started to specialize on fruit, seeds, and other plant foods. Instead of teeth to catch, the birds evolved beaks to pluck and pick.

Among the birds that began to lose teeth in favor of beaks, the way beaks form during development may have helped the evolutionary shift. “Changes to the skull and face as the beak became more complex may have moved developing tissues around, changing how they interact in the embryo, and resulted in the loss of tooth formation,” says King’s College London anatomist Abigail Tucker.

“All the things that make birds, birds, were already in place well before the mass extinction,” says University College London anatomist Ryan Felice.

When the extinction struck, the traits birds had been evolving for millions of years made the difference between life and death. While some birds survived the impact and its aftermath, not all of them did. “When we think about hypotheses of traits that let birds survive, we need to take into account that it was only a small sliver of diversity that made it to the other side,” Felice says. Entire groups of birds, such as toothed birds called enantiornithes, went extinct. It’s unlikely that one single trait determined the fate of all these species. Still, surviving extinction often comes down to luck, and beaks may have been some birds’ ace.

By the end of the Cretaceous, beaked birds were already eating a much more varied diet than their toothed relatives. These birds weren’t specialized on insects or other animal food, and so they were able to pluck up hard food items like seeds and nuts. And in the aftermath of the extinction, when animal life was severely cut back, those hard, persistent little morsels got beaked birds through the hard times. Beaked birds were able to feed on the seeds of the destroyed forests and wait out the decades until vegetation began to return.

Not that beaks guaranteed survival of the impact event. The duck-like bird Vegavis lived at the end of the Cretaceous and had a beak, yet there’s no indication that this avian survived. “Just having a beak was not enough,” Tucker says. Rather, it’s that birds with beaks and powerful gizzards capable of crushing tough seeds had an unexpected advantage that increased their chances of survival.

Both fossils and the timeline of bird evolution discerned from their genetic relationships indicates that early members of modern bird groups—such as birds related to ducks, parrots, and chickens—were around by time the asteroid struck. These groups still suffered losses, but enough survived to set up a new pulse of bird evolution in the millions of years following the catastrophe. Many bird lineages became smaller in size while maintaining their brain size. Through evolutionary shrinking, birds wound up with larger brains compared to their body size, setting the stage for avian intelligence beyond what the non-avian dinosaurs could have evolved.

But big evolutionary changes often come with constraints. “The loss of teeth does limit the number of dietary niches birds could explore,” Felice says. “Herbivorous mammals and non-avian dinosaurs evolved ever-growing teeth so that could continue eating as the plants wore their teeth down, but this just isn’t possible with a beak,” Felice says. And that means that bird skulls haven’t needed to vary as much to support different jaws and ways of feeding, meaning that birds look like evolutionary slowpokes compared to non-avian dinosaurs—as Felice and colleagues found in a new study of bird skull evolution.

To understand more about how birds managed to survive and make a living in a world recovering from one of the worst mass extinctions of all time, the task at hand is to find more fossils from the time directly following the mass extinction, from a time called the Paleocene. Paleontologists have some great examples of fossil birds from about 10 million years after the disaster, from a time called the Eocene, but birds fossils from the slice in between the Cretaceous and Eocene are fragmentary and hard to find. These are the bones that may reveal new secrets.