Among mammals, the members of some Orders have relatively large brains. Alternative explanations for this have emphasized either social or ecological selection pressures favouring greater information-processing capacities, including large group size, greater foraging efficiency, higher innovation rates, better invasion success and complex problem solving. However, the focal taxa for these analyses (primates, carnivores and birds) often show both varied ecological competence and social complexity. Here, we focus on the specific relationship between social complexity and brain size in ungulates, a group with relatively simple patterns of resource use, but extremely varied social behaviours. The statistical approach we used, phylogenetic generalized least squares, showed that relative brain size was independently associated with sociality and social complexity as well as with habitat use, while relative neocortex size is associated with social but not ecological factors. A simple index of sociality was a better predictor of both total brain and neocortex size than group size, which may indicate that the cognitive demands of sociality depend on the nature of social relationships as well as the total number of individuals in a group.