Water heaters of all types are often equipped with anode rods made of magnesium or another non-zinc metal. Magnesium and similar metals are used to reduce corrosion inside the water heater tank. but if your home water has high levels of sulfur, the magnesium can react with the sulfur to create hydrogen sulfide gas, a potentially harmful water contaminant with a distinct rotten egg smell. This magnesium/sulfur reaction is almost always the culprit when homeowners report a rotten egg smell around their water heaters.
For many homeowners, the foul smell of the hydrogen sulfide gas is reason alone to address this issue. But the presence of hydrogen sulfide gas in your home water can attract sulfur bacteria, micro-organisms that feed on sulfur and that can contaminate your water. Even if there is no sulfur bacteria in the water, the hydrogen sulfide gas imparts an offensive odor to your water that can make everything from showering to watering your plants uncomfortable.
The most commonly recommended way to address this problem is to replace the anode itself that is causing the chemical reaction. Magnesium anodes can be replaced with ones made of aluminum, zinc or another non-magnesium metal. Anodes can typically be purchased at hardware stores or wherever you purchased the water heater itself and usually need to be installed by a professional. Alternatively, you can remove the anode altogether since it is not critical to the normal functioning of the water heater.
If you replace or remove the anode and your water still has a distinct smell of rotten eggs, it is important to have the water quality tested, particularly if your home uses a water well. This odor of hydrogen sulfide could indicate the presence of harmful sulfur bacteria or could indicate a more dangerous contamination of sewage or sewer gases from the plumbing system below.