Of all the reptiles living nowadays, crocodiles and alligators may be the least altered from their ancestors of the late Cretaceous period--although the even earlier crocodiles of the Triassic and Jurassic sported some specifically un-croc like features, such as bipedal postures and vegetarian diets.

Crocodiles were an consequence of the archosaurs, the "ruling lizards" of the Triassic period that preceded the dinosaurs. To simplify matters significantly, by about 200 million years ago, archosaurs had evolved into three separate reptile families: dinosaurs, pterosaurs (flying reptiles), and crocodiles.

Confusingly, the initial dinosaurs and crocodiles resembled one another a lot more than either resembled the first pterosaurs. What illustrious crocodiles from their worldly cousins was the shape and musculature of their jaws, which tended to be much more toxic. It was only tens of millions of years afterward that crocodiles evolved the traits with which they're linked today: stubby legs, sleek bodies, and aquatic lifestyles. 

 

Crocodiles at the past time:

Before the first crocodiles emerged on the view, there were the phytosaurs ("plant lizards"): reptiles that looked very much similar to crocodiles, apart from that their nostrils were located on the tops of their heads rather than the tips of their snouts. You might presume from their name that phytosaurs were vegetarians, but in detail they subsisted on fish and marine organisms in freshwater lakes and rivers. Amongst the most notable phytosaurs were Rutiodon and Mystriosuchus. 

Unusually enough, except for the place of their nostrils, phytosaurs looked more like modern crocodiles than the very first crocodiles did. While they first evolved, crocodiles were normally fast, terrestrial, two-legged sprinters, and some of them were vegetarians (presumably because neighboring dinosaurs were better adapted at hunting for live prey). Erpetosuchus and Doswellia are superior candidates for the first true crocodiles, while the exact evolutionary relationships are still uncertain. 

 

Crocodile at the present time :

By the start of the Jurassic period (about 150 million years back), crocodiles had mostly deserted their terrestrial lifestyles. This is when we begin to see the aquatic adaptations that describe modern crocodiles and alligators: Long bodies, splayed limbs, and narrow, flat, tooth-studded snouts with powerful jaws (a necessary feature, since most crocodiles feasted on large dinosaurs and other animals that ventured too close to the water). There was still room for modernism, though: for example, paleontologists consider that Stomatosuchus subsisted on plankton and krill, like a blue whale! 

By about 100 million years back, some crocodiles had begun to emulate their dinosaur cousins by rising to enormous sizes. The king of the Cretaceous crocodiles was Sarcosuchus, dubbed "SuperCroc" by the trendy media, which attained sizes of about 40 feet long and 8 tons. And let's not forget the somewhat smaller Deinosuchus, the "deino" in whose name connotes the same thing as the "dino" in dinosaurs: "terrible" or "fearsome." 

One way in which crocodiles were certainly more formidable than their terrestrial cousins was their facility to survive the K/T Extinction, which wiped the dinosaurs off the face of the earth 65 million years ago. Today's crocodiles and alligators are slight changed from their olden ancestors, a telling hint that these reptiles were (and remain) really well adapted to their environment.