Hydrogen is a promising alternative energy without greenhouse gas emissions. The transition metal carbides (TMCs) are considered a sustainable alternatives to noble metals in catalysis. Among the TMCs, CoxC (x = 2, 3) nanoparticles (NPs) act as an excellent electrocatalyst for hydrogen evolution reaction (HER) by water splitting. In our report, CoxC nanocomposites were synthesized by wet chemistry method using cobalt (II) acetate, sodium hydroxide as precursors and triethylene glycol as solvent. In addition, Co2C NPs were synthesized by similar wet chemistry method using cobalt (II) acetate as precursors and triethylene glycol, oleylamine as solvent. The cobalt carbide NPs exhibited high electrocatalytic activity. CoxC nanocomposites performed a −0.33 V onset potential and 91 mV/dec Tafel slope, while the Co2C NPs exhibited a better performance of −0.27 V and 60 mV/dec, respectively.