According to optimal distinctiveness theory (ODT), individuals prefer social groups that are relatively distinct compared to other groups in the individuals' social environment. Distinctive groups (i.e., groups of moderate relative size) are deemed optimal because they allow for feelings of inclusion and social connection while simultaneously providing a basis for differentiating the self from others. However, ODT is a theory about individual preferences and, as such, does not address the important question of what types of groups are actually formed as a function of these individual-level preferences for groups of a certain size. The goal of the current project was to address this gap and provide insight into how the nature of the social environment (e.g., the size of the social neighborhood) interacts with individual-level group size preferences to shape group formation. To do so, we developed an agent-based model in which agents adopted a social group based on an optimal group size preference (e.g., a group whose size represented 20% of the social neighborhood). We show that the assumptions of optimal distinctiveness theory do not lead to individually satisfactory outcomes when all individuals share the same social environment. We were able to produce results similar to those predicted by ODT when social neighborhoods were local and overlapping. These results suggest that the effectiveness of a social identity decision strategy is highly dependent on sociospatial structure. © JASSS.