This paper studies the link between credit conditions and formalization in Brazil. Over the last decade, Brazil has experienced a large increase in the level of credit and the rate of formalization. these changes are linked to a reduction in the cost of credit and policy reforms oriented toward improving the efficiency of the financial sector. The paper develops a model with endogenous formal and informal sectors to evaluate how much of the change in corporate credit and the size of the formal sector can be attributed to a reduction in financial intermediation costs. The model predicts that the reduction in intermediation costs generates an increase in the credit-to-output ratio and the fraction of formal workers, in line with the data. By affecting the allocation of capital and the entry and exit rates, the change in credit conditions has important implications for the firm size distribution and aggregate productivity.