In this paper, we investigate the importance of aggregate fluctuations for the assessment of the optimal level of public debt in an incomplete-markets economy. We start by building a steady state model in which households are only subject to uninsurable idiosyncratic risk and evaluate the optimal level of public debt. We then augment the model to allow for aggregate risk and measure the impact on the optimal level. We show that the cyclical behavior of the economy has a quantitative impact on this level that can be decomposed into the effects of the aggregate productivity shock and the cyclicality of unemployment. Moreover, we find that matching wealth distribution statistics substantially changes the optimal level of public debt.