When a bank experiences an adverse shock to its equity capital, one way to return to target leverage is to sell assets. The price impact of the fire sale may impact other institutions with common exposures, resulting in contagion. We propose a simple framework that accounts for this effect. This framework explains how the distribution of leverage and risk exposures across banks contributes to systemic risk. We use it to compute a bank's exposure to sector-wide deleveraging, as well as the spillover of a bank's deleveraging onto other banks. We explain how the model can be used to evaluate a variety of policy proposals, such as caps on size or leverage, mergers of good and bad banks, and equity injections. We then apply the framework to measure (a) the vulnerability of European banks to sovereign risk in 2010 and 2011, and (b) the vulnerability of US financial institutions between 2001 and 2010. In our model, \microprudential" interventions, which target the solvency of individual banks are always less effective than \macroprudential", policies which aim to minimize spillovers across firms.