Quick Answer
A like-for-like electric water heater swap is a 3 to 4 hour DIY project for a confident homeowner. A like-for-like gas water heater swap is borderline DIY because of the gas line, draft testing and combustion air requirements. A tankless installation is not DIY for first-timers.
Most U.S. jurisdictions require a permit and inspection for any water heater install, even by the homeowner. The permit fee runs 50 to 200 dollars and includes the inspection that catches the things insurance will reject otherwise.
Code Items You Cannot Skip
- Expansion tank on the cold supply (required almost everywhere since 2012).
- T&P (temperature and pressure) relief valve with discharge pipe to within 6 inches of the floor.
- Drip pan with drain in attics and floors above living space.
- Seismic strapping in earthquake zones (UPC 508.2).
- Sediment trap on gas supply line.
- 3 inch clearance around vent connector for atmospheric gas units.
Electric Water Heater Swap
- Turn off the breaker. Confirm with a voltage tester at the wires inside the top access panel.
- Shut off the cold supply. Open the drain valve at the bottom and run a hose to a floor drain or outside.
- Open the T&P valve to break the vacuum and speed draining.
- Disconnect electrical, supply and discharge lines.
- Walk old heater out. Position new heater, level it.
- Connect cold supply with a new flex line, hot to outlet, expansion tank on cold side.
- Wire to the same conduit and breaker, fill the tank fully before turning on the breaker (firing an empty heater burns out the elements in seconds).
Gas Water Heater Swap
Same drain procedure, but the gas side adds:
- Shut off gas at the appliance valve. Disconnect with two wrenches, never just one.
- Use yellow Teflon tape rated for gas, not standard white.
- Reuse or replace the flexible appliance connector. Most codes require new on a new install.
- After reconnection, leak-test every joint with soapy water. Any bubble means redo.
- Check draft with a smoke test (a smoking incense stick at the draft hood, smoke should pull cleanly up).
The draft and combustion air checks are the parts most DIYers skip. They are also the reason an unpermitted install can kill via CO poisoning.
Why Tankless Is Not DIY
- Larger gas line (often 3/4 inch where the tank used had 1/2 inch).
- Dedicated vent through the wall, condensing units need PVC with a slope.
- 120 V outlet at the unit.
- Cold water descaling loop, manufacturer-specified.
- Manufacturer warranty almost always requires installation by a licensed contractor.
Cost Comparison
- 40 gallon electric: 450 to 800 dollars unit, 500 to 900 dollars labor.
- 40 gallon gas: 600 to 1,100 dollars unit, 700 to 1,300 dollars labor.
- Tankless gas: 1,000 to 2,200 dollars unit, 1,800 to 3,500 dollars labor.
Disposal
Old water heaters go to a metal recycler, not the curb. Many recyclers pay 5 to 15 dollars by weight. Drain completely first, an empty 40 gallon tank weighs about 110 pounds.
Bottom Line
Pull the permit, replace an electric unit yourself, replace a gas unit yourself only if you can leak test and draft check confidently. Hire a plumber for tankless. The expansion tank, T&P discharge and seismic strap are not optional details, they are what the inspector looks at first.
Common Questions About Installing a Water Heater
What size water heater do I need?
30 to 40 gallons for 1 to 2 people, 40 to 50 for 3 to 4, 50 to 80 for 5 plus. Tankless is sized by GPM at the desired temperature rise, not gallons. Installing a water heater of the right size matters more than the brand.
How long does a water heater last?
Tank gas: 10 to 13 years. Tank electric: 12 to 15. Tankless: 18 to 25 with annual descaling. Anode rod replacement every 4 to 5 years roughly doubles tank life.
Heat pump water heater, worth it?
Yes, in mild climates with a basement or garage install. About 2 to 3 times more efficient than electric resistance. Qualifies for federal 25C tax credit at 30 percent of cost up to 2,000 dollars.
What is an expansion tank for?
When water heats it expands. In a closed plumbing system (with a backflow preventer on the main), that expansion has nowhere to go and creates pressure spikes. The expansion tank absorbs it. Required by most modern codes.
Can I use PEX or do I need copper?
PEX is allowed within 18 inches of the water heater if rated for the temperature, otherwise use copper or CPVC for the first 18 inches. Manufacturer's instructions are the controlling document.
Why does my new heater take longer to recover?
Probably wrong dip tube length or sediment in the bottom of an old tank you reused. Flush new heaters annually for the first 3 years to prevent sediment buildup.



