Dinosaurs roamed the Earth during a geological period known as the Mesozoic Era, which lasted from approximately 252 million years ago to 66 million years ago. The Mesozoic Era is divided into three major periods: the Triassic, Jurassic, and Cretaceous. Dinosaurs first appeared during the Triassic period, around 230 million years ago, and they dominated the Earth for over 160 million years until the end of the Cretaceous period when they became extinct. The most famous extinction event associated with the dinosaurs is the Cretaceous-Paleogene extinction event, which occurred approximately 66 million years ago and led to the demise of most dinosaur species.