This article concerns the optimal choice of flat taxes on labor and capital income, and on consumption, in a tractable economic model. Agents manage a portfolio of bonds and physical capital while subject to idiosyncratic investment risk and random mortality. We identify the tax rates which maximize welfare in stationary equilibrium while preserving tax revenue, finding that a very large increase in welfare can be achieved by only taxing capital income and consumption. The optimal rate of capital income taxation is zero if the natural borrowing constraint is strictly binding on entrepreneurs, but may otherwise be positive and potentially large. The Domar-Musgrave effect, whereby capital income taxation with full offset provisions encourages risky investment through loss sharing, explains cases where it is optimal to tax capital income. In further analysis we study the dynamic response to the substitution of consumption taxation for labor income taxation. We find that consumption immediately drops before rising rapidly to the new stationary equilibrium, which is higher on average than initial consumption for workers but lower for entrepreneurs.