This paper proposes a novel methodology to calibrate the magnitude of the cap on the countercyclical capital buffer (CCyB) using market-based stress tests. The macroprudential authority in our paper aims to contain the possibility of a breach of a minimum capital ratio in the event of a severe system-wide shock within a certain permissible failure probability. To meet its objective during periods of challenging macro-financial conditions, the macroprudential authority requires banks to build up the CCyB during credit booms. We show how market-based stress tests can be used to estimate the necessary magnitude of the CCyB. We apply the methodology to major banks in six advanced economies. Our estimates suggest a magnitude of the cap on the CCyB in a range from 1.4 to 1.7 per cent of total assets, depending on the ability of the macro-prudential authority to forecast macrofinancial conditions.