This research examines the utilization of regenerative braking energy in hydrogen fuel-cell railway systems to decrease onboard hydrogen usage. Provided that the necessary technologies are accessible and can be rapidly implemented, the recovered braking energy is directed either (i) to a traction battery for subsequent traction use or (ii) to an onboard electrolyzer that separates the fuel cell's water by-product into hydrogen and oxygen. The produced hydrogen is reintroduced as auxiliary fuel, facilitating equilibrium between hydrogen generated through electrolysis and hydrogen extracted from storage. Under defined testing settings for two train archetypes, the technique reduces total energy consumption and hydrogen requirements: a reduction of up to 36.3% for a mass-transit service spanning 17.4 km, and up to 42.1% for a shunting locomotive transporting container freight over about 180 km. The findings suggest that repurposing regenerative energy for onboard electrolysis can significantly enhance range or diminish refueling requirements, contingent upon the implementation of suitable power electronics, storage solutions, and safety protocols.