The development of highly active and stable earth-abundant catalysts to reduce or eliminate the reliance on noble-metal based ones in green and sustainable (electro)chemical processes is nowadays of great interest. Here, N-, O-, and S-tridoped carbon-encapsulated Co 9 S 8 (Co 9 S 8 @NOSC) nanomaterials are synthesized via simple pyrolysis of S-and Co(II)-containing polypyrrole solid precursors, and the materials are proven to serve as noble metal-free bifunctional electrocatalysts for water splitting in alkaline medium. The nanomaterials exhibit remarkable catalytic performances for oxygen evolution reaction in basic electrolyte, with small overpotentials, high anodic current densities, low Tafel slopes as well as very high (nearly 100%) Faradic efficiencies. Moreover, the materials are found to efficiently electrocatalyze hydrogen evolution reaction in acidic as well as basic solutions, showing high activity in both cases and maintaining good stability in alkaline medium. A two-electrode electrolyzer assembled using the material synthesized at 900 °C (Co 9 S 8 @NOSC-900) as an electrocatalyst at both electrodes gives current densities of 10 and 20 mA cm −2 at potentials of 1.60 and 1.74 V, respectively. The excellent electrocatalytic activity exhibited by the materials is proposed to be mainly due to the synergistic effects between the Co 9 S 8 nanoparticles cores and the heteroatom-doped carbon shells in the materials.