Clean energy conversion technologies require low-cost multifunctional catalysts. In this work, nitrogen-doped hollow carbon spheres with nanoporous shells (NHCS–W) are prepared by using the ionic liquid 1-butyl-3-methylimidazolium chloride as a source of both carbon and nitrogen. A systematic investigation of the electrocatalytic performance and durability of NHCS–W reveals excellent performance and high stabilities for the oxygen reduction reaction, oxygen evolution reaction, and hydrogen evolution reaction in alkaline electrolytes. This multifunctionality facilitates promising practical applicability for NHCS–W. An alkaline exchange membrane fuel cell (AEMFC) with NHCS–W as the cathode electrocatalyst has a peak power density of 109 mW cm−2, which is 7 mW cm−2 higher than that of an AEMFC with Pt/C (20%) as the cathode electrocatalyst. By using NHCS–W as an air electrode, two rechargeable Zn–air batteries in series can power a 5 mm red light-emitting diode (~2.2 V). Moreover, a cell voltage of only 1.61 V is needed to achieve a current density of 10 mA cm−2 in a water-splitting electrolyzer employing NHCS–W as both the cathode and anode catalysts. This work reveals the potential of ionic liquid precursors for constructing nitrogen-doped carbon-based materials for a wide variety of electrocatalytic applications.