In this paper we use a single-equation time series approach to examine the macroeconomic determinants of banks' loan quality in Italy in the past twenty years, as measured by the ratio of new bad loans to the outstanding amount of loans in the previous period. We analyse the quality of loans to households and firms separately on the grounds that macroeconomic variables may affect these two classes of borrowers differently. According to our estimated models: i) the quality of lending to households and firms can be explained by a small number of macroeconomic variables mainly relating to the general state of the economy, the cost of borrowing and the burden of debt; ii) changes in macroeconomic conditions generally affect loan quality with a lag; and iii) the out-of-sample prediction accuracy of the models is quite satisfactory and proved to be robust to the recent financial crisis.