The development of efficient and low-cost bifunctional electrocatalysts for oxygen evolution reaction (OER) and hydrogen evolution reaction (HER) is highly desirable for electrochemical energy conversion. Herein, this study puts forward a new Co decorated N,B-codoped interconnected graphitic carbon and carbon nanotube materials (Co/NBC) synthesized by direct carbonization of a cobalt-based boron imidazolate framework. It is demonstrated that the carbonization temperature can tune the surface structure and component of the resultant materials and optimize the electrochemically active surface area to expose more accessible active sites, effectively boosting the electrocatalytic activity. As a result, the optimized Co/NBC shows superior bifunctional catalytic activity and stability toward OER and HER in 1.0 m KOH solution. Furthermore, the catalyst can serve as both the anode and cathode for water splitting to achieve a current density of 10 mA cm −2 at a cell voltage of 1.68 V. Experimental results and theoretical calculations indicate that the excellent activity of Co/NBC catalyst benefits from the synergistic effect of partial oxidation of metallic cobalt, conductive N,B-codoped graphitic carbon and carbon nanotube, and the coupled interactions among these components. This work opens a promising avenue toward the exploration of boron imidazolate frameworks as efficient heteroatom-doped catalysts for electrocatalysis.