Fission–fusion dynamics hypothetically enable animals to exploit dispersed and ephemeral food resources while minimizing predation risk. Disentangling factors affecting group size and composition of fission–fusion species facilitates their management and conservation. We used a 6-year data set of 2888 group formations of Masai giraffes in Tanzania to investigate determinants of social group size and structure. We tested whether ecological (lion density, vegetation structure, and prevalence of primary forage plants), anthropogenic (proximity to human settlements), temporal (rainy or dry season), and social (local giraffe density, adult sex ratio, and proportion of calves) factors explained variation in group size and sex- and age-class composition. Food availability rather than predation risk mediated grouping dynamics of adult giraffes, while predation risk was the most important factor influencing congregations with calves. Smallest group sizes occurred during the food-limiting dry season. Where predation risk was greatest, groups with calves were in bushlands more than in open grasslands, but the groups were smaller in size, suggesting mothers adopted a strategy of hiding calves rather than a predator-detection-and-dilution strategy. Groups with calves also were farther from towns but closer to traditional human compounds (bomas). This may be due to lower predator densities, and thus reduced calf predation risk, near bomas but higher human disturbance near towns. Sex- and age-based differences in habitat use reflected nursing mothers’ need for high-quality forage while also protecting their young from predation. Our results have implications for conservation and management of giraffes and other large-bodied, herd-forming ungulates in heterogeneous environments subject to anthropogenic threats.