Membership design involves allocating an economic good whose value to any individual depends on who else receives it. We introduce a framework for optimal membership design by combining an otherwise standard mechanism-design model with allocative externalities that depend flexibly on agents’ observable and unobservable characteristics. Our main technical result demonstrates that the optimal mechanism offers distinct membership tiers—differing in prices and level of access—and that the number of membership tiers is increasing in the complexity of the externalities. This insight may help explain a number of mechanisms used in practice to sell membership goods, including musical artists charging below-market-clearing prices for concert tickets, certain admission procedures used by colleges concerned about the diversity of the student body, heterogeneous pricing tiers for access to digital communities, and the use of vesting and free allocation in the distribution of network tokens.