AbstractAimBody size evolution has long been hypothesized to have been driven by factors linked to climate change, but the specific mechanisms are difficult to disentangle due to the wide range of functional traits that covary with body size. In this study, we investigated the impact of regional habitat changes as a potential indirect effect of climate change on body size evolution.LocationEurope and North America.Time periodThe Neogene (~23–2 million years ago).Major taxaFive orders of terrestrial mammals: Artiodactyla, Carnivora, Perissodactyla, Proboscidea and Primates.MethodsWe compared the two continental faunas, which have exceptional fossil records of terrestrial mammals and underwent different processes of habitat transition during the Neogene. Using Bayesian multilevel regression models, we assessed the variation in the temporal dynamics of body size diversity among ecographic groups, defined by their continent of occurrence and dietary preference.ResultsModel comparisons unanimously supported a combined effect of diet and continent on all metrics of body size frequency distributions, rejecting the shared energetic advantage of larger bodies in colder climates as a dominant mechanism of body size evolution. Rather, the diet‐specific dynamics on each continent pinpointed an indirect effect of climate change – change in habitat availability, and thus the resource landscape as a key driver of mammalian evolution.Main conclusionsOur study highlights dietary preference as a mechanistic link between mammalian evolution and habitat transition mediating an indirect climate‐change effect and demonstrates the complexity of climatic influence on biodiversity. Our findings suggest that the intensified habitat modification today likely poses a bigger threat than climate change in itself to living mammals, and perhaps all endotherms.