Fission–fusion events, i.e. changes to the size and composition of animal social groups, are a mechanism to adjust the social environment in response to short-term changes in the cost–benefit ratio of group living. Furthermore, the time and location of fission–fusion events provide insight into the underlying drivers of these dynamics. Here, we describe a method for identifying group membership over time and for extracting fission–fusion events from animal tracking data. We applied this method to high-resolution GPS data of free-ranging sheep (
Ovis aries
). Group size was highest during times when sheep typically rest (midday and at night), and when anti-predator benefits of grouping are high while costs of competition are low. Consistent with this, fission and fusion frequencies were highest during early morning and late evening, suggesting that social restructuring occurs during periods of high activity. However, fission and fusion events were not more frequent near food patches and water resources when adjusted for overall space use. This suggests a limited role of resource competition. Our results elucidate the dynamics of grouping in response to social and ecological drivers, and we provide a tool for investigating these dynamics in other species.