Utilizing supramolecular synthetic macrocycles with distinct porous structures and abundant functional groups as a precursor for metal-doped carbon electrocatalysts can endow the resulting materials with great potential in electrocatalysis. Herein, iridium-doped electrocatalysts (CBC-Ir), using a synthetic macrocycle named cucurbit[6]uril as the carbon source precursor, are designed and prepared. Interestingly, owing to the numerous N-containing backbone and unique porous structure from cucurbit[6]uril self-assembly, the newly designed catalysts CBC-Ir possess abundant N-doped and mesoporous structures without the need of additional N sources and templates. The catalysts exhibit superior catalytic performance toward the hydrogen evolution reaction with high Faradaic efficiency (91.5% and 92.7%), superior turnover frequency (2.1 and 0.69 H 2 s −1 ) at the 50 mV overpotential, and only 17 and 33 mV overpotentials in acidic and alkaline conditions reaching the current density of 10 mA cm −2 , better than the commercial Pt/C (28 and 43 mV). This work not only expands the application of supramolecular macrocycles in the water splitting field but also provides a new approach for preparing robust electrocatalysts.