We study how financial frictions affect firm-level heterogeneity and trade. We build a model where productivity differences across monopolistically competitive firms are endogenous and depend on investment decisions at the entry stage. By increasing entry costs, financial frictions lower the exit cutoff and hence the value of investing in bigger projects with more dispersed outcomes. As a result, credit frictions make firms smaller and more homogeneous, and hinder the volume of exports. Export opportunities, instead, shift expected profits to the tail and increase the value of technological heterogeneity. We test these predictions using comparable measures of sales dispersion within 365 manufacturing industries in 119 countries, built from highly disaggregated US import data. Consistent with the model, financial development increases sales dispersion, especially in more financially vulnerable industries; sales dispersion is also increasing in measures of comparative advantage. These results can be important for explaining the effect of financial development and factor endowments on export sales.