Using a unique data set on trade credit defaults among French firms, we investigate whether and how trade credit is used to relax financial constraints. We show that firms that face idiosyncratic liquidity shocks are more likely to default on trade credit, especially when the shocks are unexpected, firms have little liquidity, are likely to be credit constrained or are close to their debt capacity. We estimate that credit constrained firms pass more than one fourth of the liquidity shocks they face on to their suppliers down the trade credit chain. The evidence is consistent with the idea that firms provide liquidity insurance to each other and that this mechanism is able to alleviate the consequences of credit constraints. In addition, we show that the chain of defaults stops when it reaches firms that are large, liquid, and have access to financial markets. This suggests that liquidity is allocated from large firms with access to outside finance to small, credit constrained firms through trade credit chains.