Dinosaurs lived on Earth for approximately 165 million years, from the Triassic period (about 252 million years ago) to the end of the Cretaceous period (about 66 million years ago).