We study Pareto-optimal fiscal policy in a model with agents who are heterogeneous in their labor productivity and wealth. We show a natural modification of the standard Ramsey problem to guarantee that long-run capital taxes are zero. We focus on Pareto-improving policies and we find that a gradual reform is crucial in achieving a Pareto improvement: labor taxes should be cut and capital taxes should remain high for a very long time before reaching zero. Therefore, the long-run optimal tax mix is the opposite of the short- and medium-run one. This policy redistributes wealth in favor of workers so that all agents benefit, and it favors quick capital growth after the reform. The labor tax cut is financed by deficits which lead to a positive level of government debt in the long run, reversing the standard prediction that the government accumulates savings in models with optimal capital taxes. The welfare benefits from the tax reform are relatively large and they can be shifted entirely to capitalists or workers by varying the length of the transition. We address a number of technical issues such as sufficiency of Lagrangian solutions in a Ramsey problem, relation of Pareto-improving allocations with welfare functions, asymptotic behavior, and solution algorithms.