Modern banking systems are highly interconnected. Despite their various benefits, the linkages that exist between banks carry the risk of contagion. In this paper we investigate how banks decide on direct balance sheet linkages and the implications for contagion risk. In particular, we model a network formation process in the banking system. The trade-off between the gains and the risks of being connected shapes banks ’incentives to form links. We show that banks manage to form networks that are resilient to contagion. Thus, in an equilibrium network, the probability of contagion is virtually 0.