We present a dynamic general equilibrium model with agency costs, where heterogeneous firms choose among two alternative instruments of external finance – corporate bonds and bank loans. We characterize the financing choice of firms and the endogenous financial structure of the economy. The calibrated model is used to address questions such as: What explains differences in the financial structure of the US and the euro area? What are the implications of these differences for allocations? We find that a higher share of bank finance in the euro area relative to the US is due to lower availability of public information about firms’ credit worthiness and to higher efficiency of banks in acquiring this information. We also quantify the effect of differences in the financial structure on per-capita GDP.