One of the stylized facts of unfunded social security programs is that programs are larger in size, measured relative to the GDP, the tighter the link between pension claims and past earnings. We provide a political economy explanation of this stylized fact in a median voter model, where people vote on the social security tax rate. We compare pension systems with flat-rate and earnings-related benefit formulas. Only flat-rate benefits redistribute within a generation from high to low income groups. If labor supply is endogenous, they also imply larger efficiency costs than earnings-related schemes. Using data on eight European countries, we find that the median voter is typically middle-aged with high income. For these voters, earnings-related systems are more attractive both because of less intragenerational redistribution and lower distortions in labor supply. The median voter model is also able to account for a considerable degree of cross-country variation in contribution rates.