This paper analyzes the optimal treatment of tax expenditures. It develops an optimal tax model where individuals derive utility from spending on a contribution' good such as charitable giving. The contribution good has also a public good effect on all individuals in the economy. The government imposes linear taxes on earnings and on the contribution good so as to maximize welfare. The government may also finance directly the contribution good out of tax revenue. Optimal tax and subsidy rates on earnings and the contribution good are expressed in terms of empirically estimable parameters and the redistributive tastes of the government. The optimal subsidy on the contribution good is increasing in the size of the price elasticity of contributions, the size of the crowding-out effect of public contributions on private contributions, and the size of the public good effect of the contribution good. Numerical simulations show that the optimal subsidy on contributions is fairly sensitive to the size of these parameters but that, in most cases, it should be lower than the earnings tax rate.