Incorporating non-electrochemically active elements (such as Zn and Mg) into the framework of active components can enhance structural stability, leading to improved cycling performance. However, limited research has been conducted on the impact of varying doping concentrations. In this study, we conducted a comprehensive analysis of how different levels of Mg doping in Co(OH)2 affect the supercapacitor performance. We synthesized a range of cobalt hydroxides with precisely controlled Mg content using a cation ion-exchange reaction method. Our findings suggest that the Mg component can be evenly distributed in the composite material, and when the Co/Mg ratio exceeds 1 : 1, the formation of Mg-O-Co bonds can be observed. When used as an electrode for a supercapacitor, the doped cobalt hydroxides exhibit superior performance than the undoped version and some recently reported cobalt hydroxide-based devices. Particularly, they show a high specific capacitance of 700.2 C g-1@1.0 A g-1versus 448.2 F g-1@1.0 A g-1, a large energy density of 48 W h kg-1@800 W kg-1versus 39 W h kg-1@775 W kg-1, and excellent cycling stability, with only slight fluctuations around 100% capacitance retention after 30 000 cycles of continuous charge and discharge. This research not only offers guidance on the optimal doping level of the redox-active metal hydroxides for improving supercapacitor performance but also presents a novel method for preparing various metal hydroxides/oxides and their composite forms.