Tungsten carbide exhibits platinum-like behavior, which makes it an interesting potential substitute for noble metals in catalytic applications. Tungsten carbide nanocrystals (≈5 nm) are directly synthesized through the reaction of tungsten precursors with mesoporous graphitic C(3)N(4) (mpg-C(3)N(4)) as the reactive template in a flow of inert gas at high temperatures. Systematic experiments that vary the precursor compositions and temperatures used in the synthesis selectively generate different compositions and structures for the final nanocarbide (W(2)C or WC) products. Electrochemical measurements demonstrate that the WC phase with a high surface area exhibits both high activity and stability in hydrogen evolution over a wide pH range. The WC sample also shows excellent hydrogen oxidation activity, whereas its activity in oxygen reduction is poor. These tungsten carbides are successful cocatalysts for overall water splitting and give H(2) and O(2) in a stoichiometric ratio from H(2)O decomposition when supported on a Na-doped SrTiO(3) photocatalyst. Herein, we present tungsten carbide (on a small scale) as a promising and durable catalyst substitute for platinum and other scarce noble-metal catalysts in catalytic reaction systems used for renewable energy generation.