The serial number sticker gives the manufacture date. Tank heaters typically last eight to twelve years, less in hard water areas without regular flushing. Under six years, repair almost always wins. Over twelve, replacement almost always does. Between the two, the specific fault decides.
Thermostats, heating elements, thermocouples, igniters, gas control valves, dip tubes and relief valves are all replaceable parts on an otherwise sound tank. If the tank body is not leaking, these are straightforward repairs and rarely close to replacement cost.
Water leaking from the tank body itself, rather than from a fitting or valve, means the steel has corroded through. There is no repair for that. The same applies to rusty hot water combined with an old tank, which shows the anode rod has been consumed and the tank is now the sacrificial metal.
If the repair costs more than about half the price of a new installed unit and the heater is over eight years old, replacement usually gives better value. You are buying another decade rather than another year.
If the tank has failed and the household regularly runs out of hot water, this is the moment to compare tankless properly. It costs more upfront, often needs gas line and venting work, and needs annual descaling, but it does not run out and it takes back floor space. Get both numbers before deciding.
A water heater that fails on its own schedule usually does it by flooding the garage or the closet it sits in. Replacing a tired unit on a planned Tuesday costs less and ruins nothing.
A real plumber, a flat-rate quote, any hour of the day.