Quantifying human group dynamics represents a unique challenge. Unlike animals and other biological systems, humans form groups in both real (offline) and virtual (online) spaces -- from potentially dangerous street gangs populated mostly by disaffected male youths, through to the massive global guilds in online role-playing games for which membership currently exceeds tens of millions of people from all possible backgrounds, age-groups and genders. We have compiled and analyzed data for these two seemingly unrelated offline and online human activities, and have uncovered an unexpected quantitative link between them. Although their overall dynamics differ visibly, we find that a common team-based model can accurately reproduce the quantitative features of each simply by adjusting the average tolerance level and attribute range for each population. By contrast, we find no evidence to support a version of the model based on like-seeking-like (i.e. kinship or `homophily).