Many entrepreneurs work informally because it is costly to start and run a business legally. Using a dynamic model of industry equilibrium, I show that the costs of the legal system can explain the cross country variability of the size of the informal economy. The model implies that the business start-up costs are more important than taxes and labor market regulations. Small, less productive, entrepreneurs, facing high entry costs, start informally, waiting to become more productive before legalizing. Informality is often the doorstep of the legal system.