We extend the theory of optimal redistributive taxation to economies with an informal sector. In particular, in our model, workers can supply labor simultaneously to the formal and the informal sectors, which we call moonlighting. The optimal tax formula contains two novel terms capturing informality responses on an intensive and an extensive margin. Both terms decrease the optimal tax rates. We estimate the model with Colombian data and find that informality strongly reduces tax rates at all income levels. The possibility to migrate to entirely informal employment restricts tax rates at low and medium income levels, while the possibility of moonlighting is relevant at higher earnings.