Cooperation and grouping are regularly studied as separate traits. The evolution of sociality however requires both that individuals get together in groups and that they cooperate within them. Because the level of cooperation can influence selection for group size, and vice versa, it is worth studying how these traits coevolve. Using a generally applicable two-trait optimization approach, we provide analytical solutions for three specific models. These solutions describe how cooperative associations of non-relatives evolve, and predict how large and how cooperative they will be. The analytical solutions help understand how changes in parameter values, such as the group carrying capacity and the costs of cooperation, affect group size and the level of cooperation in equilibrium. Although the analytical model makes a few simplifying assumptions-populations are assumed to be monomorphic for grouping as well as for cooperative tendencies, and group size is assumed to be deterministic-simulations show that its predictions are matched quite closely by results for settings where these assumptions do not hold. © 2010 Elsevier Ltd.