Exploring highly-efficient and pH-universal overall water splitting electrocatalysts are critical but keep challenging. Herein, a highly-efficient, dual-function and pH-universal electrocatalyst consisting of CoRu alloy nanoparticles embedded in the carbon matrix (CoRu/C) was successfully synthesized through an acid etching-pyrolysis conversion process using ZIF-67 as a precursor. Benefiting from the rich crystal defects created during the alloy formation process that could serve as active catalytic sites and the optimized electronic structure, the as-obtained CoRu/C electrocatalyst required overpotentials of only 18 and 37 mV to reach a current density of 10 mA cm−2 for hydrogen evolution reaction (HER) and 184 and 170 mV for oxygen evolution reaction (OER) in 1.0 M KOH and 0.5 M H2SO4 aqueous solution, respectively. For practical application, the CoRu/C catalyst only needs a cell voltage of 1.49 and 1.45 V in a two-electrode overall water splitting system to achieve a current density of 10 mA cm−2 in alkaline and acidic medium, respectively. The present work paves a new way for the design and construction of efficient bifunctional electrocatalyst for overall water splitting, and would inspire widespread research interest in the field of energy storage and conversion.