Crocodylomorpha, which includes living crocodylians and their extinct relatives, has a rich fossil record, extending back for more than 200 million years. Unlike modern semi-aquatic crocodylians, extinct crocodylomorphs exhibited more varied lifestyles, ranging from marine to fully terrestrial forms. This ecological diversity was mirrored by a remarkable morphological disparity, particularly in terms of cranial morphology, which seems to be closely associated with ecological roles in the group. Here, I use geometric morphometrics to comprehensively investigate cranial shape variation and disparity in Crocodylomorpha. I quantitatively assess the relationship between cranial shape and ecology (i.e. terrestrial, aquatic, and semi-aquatic lifestyles), as well as possible allometric shape changes. I also characterise patterns of cranial shape evolution and identify regime shifts. I found a strong link between shape and size, and a significant influence of ecology on the observed shape variation. Terrestrial taxa, particularly notosuchians, have significantly higher disparity, and shifts to more longirostrine regimes are associated with large-bodied aquatic or semi-aquatic species. This demonstrates an intricate relationship between cranial shape, body size and lifestyle in crocodylomorph evolutionary history. Additionally, disparity-through-time analyses were highly sensitive to different phylogenetic hypotheses, suggesting the description of overall patterns among distinct trees. For crocodylomorphs, most results agree in an early peak during the Early Jurassic and another in the middle of the Cretaceous, followed by nearly continuous decline until today. Since only crown-group members survived through the Cenozoic, this decrease in disparity was likely the result of habitat loss, which narrowed down the range of crocodylomorph lifestyles.