Government-financed bank restructuring programs, occasionally costing up to 50% of GDP, are commonly used to resolve banking crises. We analyze the Ramsey-optimal paths of bank recapitalization programs that weigh recapitalization benefits and costs under different financing options. In our model bank credit is essential, due to a working capital constraint on firms, and banks are financial intermediaries that borrow from households and lend to firms. A banking crisis produces a disruption of credit and a fall in output equivalent to those in developing countries affected by banking crises. Full recapitalization of the banking system immediately after the crisis is optimal only if international credit is available. One-shot recapitalization is not optimal with domestically-financed programs, even if the government has access to non-distortionary taxes. The welfare cost of a crisis is substantial: the equivalent permanent decline in the no-crisis steady state consumption ranges between 0.51% and 0.65%, depending on the source of financing the recapitalization program.