What shapes the optimal degree of progressivity of the tax and transfer system? On the one hand, a progressive tax system can counteract inequality in initial conditions and substitute for imperfect private insurance against idiosyncratic earnings risk. On the other hand, progressivity reduces incentives to work and to invest in skills, distortions that are especially costly when the government must finance public goods. We develop a tractable equilibrium model that features all of these trade-offs. The analytical expressions we derive for social welfare deliver a transparent understanding of how preference, technology, and market structure parameters influence the optimal degree of progressivity. A calibration for the U.S. economy indicates that endogenous skill investment, flexible labor supply, and the desire to finance government purchases play quantitatively similar roles in limiting optimal progressivity. In a version of the model where poverty constrains skill investment, optimal progressivity is close to the U.S. value. An empirical analysis on cross-country data offers support to the theory.