Abstract: We analyze the Probability of Default (PD) of non-financial corporations in Europe using Random Forests (RF) and assess implications for stress testing the banking sector. To this end, we exploit data on firms’ financial statements (Orbis) and banks’ credit registry (Anacredit). We show that RF displays stronger risk sensitivity than logistic regression in stress testing, shedding new light on the non-linear effect of scenario severity on PD. Moreover, we show how RF-based PD can be used in a network of banks and firms to stress test the banking sector through loan exposures as a key transmission channel of adverse scenarios. A granular inspection of banks’ riskiness indices derived from this network sheds light also on RF’s superior ability in capturing non-linearity thanks to its capability in identifying “tail banks”. Our work is relevant for central banks and banking supervisors alike.