In general, you should replace your gas or electric water heater every eight to 12 years, and your tankless water heater after about 20 years. No matter which type you have, you should always follow best practices for having your water heater inspected or serviced to maximize its longevity.