Public goods games are models of social dilemmas where cooperators pay a cost for the production of a public good while defectors free ride on the contributions of cooperators. In the traditional framework of evolutionary game theory, the payoffs of cooperators and defectors result from interactions in groups formed by binomial sampling from an infinite population. Despite empirical evidence showing that group-size distributions in nature are highly heterogeneous, most models of social evolution assume that the group size is constant. In this article, I remove this assumption and explore the effects of having random group sizes on the evolutionary dynamics of public goods games. By a straightforward application of Jensen’s inequality, I show that the outcome of general nonlinear public goods games depends not only on the average group size but also on the variance of the group-size distribution. This general result is illustrated with two nonlinear public goods games (the public goods game with discounting or synergy and the N-person volunteer’s dilemma) and three different group-size distributions (Poisson, geometric, and Waring). The results suggest that failing to acknowledge the natural variation of group sizes can lead to an underestimation of the actual level of cooperation exhibited in evolving populations.