Abstract The ongoing war in Ukraine has thrust China–Russia relations into the global spotlight, with both nations asserting their stance against forming a military alliance. This article introduces a novel ‘balance-of-beliefs’ framework, positing that the foundation of peacetime alliances lies in leaders' shared beliefs. Using operational code analysis, this study quantifies the philosophical and instrumental beliefs of leaders from the United States (Barack Obama), Australia (Tony Abbott), China (Xi Jinping) and Russia (Vladimir Putin) between 2013 and 2015, and includes additional comparison between Putin and Xi between 2016 and 2022. This research examines the essential role of aligned world-views on ‘the nature of the political universe’ (which we label a P-1 belief) and ‘the strategic approach to achieving political objectives’ (an I-1 belief). The findings reveal that such congruence is crucial for fostering like-minded alliances in peacetime, as evidenced by the US–Australia alliance. In contrast, the divergent P-1 beliefs of Xi and Putin hinder a Sino-Russian military alliance; yet, their aligned I-1 beliefs facilitate pragmatic cooperation on specific issues. This analysis underscores the need for US and European policy-makers to devise nuanced strategies in response to the evolving dynamics of a rising China and a resurgent Russia.