How to Install a Water Heater: Gas and Electric Steps, Code Items, and Cost
To install a water heater, shut off the fuel and water, drain and remove the old tank, set the new one, connect water, relief line, venting and power, then fill it completely before you fire it.
Key Takeaways
- A complete tank install runs $1,200 to $2,300, of which labor is roughly $300 to $800, per This Old House using The Home Depot data.
- Gas is the hard line: many jurisdictions require a licensed plumber or gas fitter, and the International Residential Code (IRC) adds sediment trap, venting, and combustion-air rules.
- The T&P relief discharge line must run full size, by gravity, and end no more than 6 inches above the floor or drain, under IRC Section P2804.6.1.
- Closed water systems need thermal expansion control under IRC Section P2903.4; an expansion tank adds $40 to $150, per This Old House.
- Where seismic strapping applies (IRC Section M1307.2, and statewide in California under Health and Safety Code 19211), straps go in the upper and lower thirds of the tank.
- Electric heaters need a 240-volt circuit rated at 125 percent of nameplate current (NEC Section 422.13), and a full tank before power goes on.
Can you install a water heater yourself, or should you hire a pro?
You can install a water heater yourself in many areas if you own and live in the home, pull a permit, and pass inspection. An electric tank swap in the same spot is the realistic DIY job. Gas is harder: many jurisdictions require a licensed plumber or gas fitter, and a venting mistake can put carbon monoxide in the house.
The money at stake is labor: $300 to $800 on a tank install, per This Old House. That is the ceiling on what you save, and one leaking gas fitting or a failed inspection eats it fast.
A quick test:
- DIY is reasonable for an electric tank, same size and location, on a correct circuit, where homeowner permits are allowed.
- Hire a pro if it is gas, a fuel switch, a relocation, or tankless, or if you smell gas or the vent is shared with a furnace.
These steps cover standard storage tanks. Tankless and heat pump units bring different venting, gas sizing, and condensate needs, which our guide to the types of water heaters compares side by side.

What permit and code items does a water heater install need?
Most water heater installs need a plumbing permit, and many need a gas or electrical permit too, depending on your city or county. The inspector checks a short list: the temperature and pressure (T&P) relief discharge line, thermal expansion control, venting and combustion air on gas units, the gas sediment trap and shutoff, and seismic strapping where required.
Section numbers below come from the 2021 International Residential Code. Your area may use another edition, the Uniform Plumbing Code, or local amendments, so confirm with your building department. Our full rundown of water heater code requirements covers drip pans, clearances, and attic installs in more depth.
T&P relief discharge line
Under IRC Section P2804.6.1, the discharge pipe must be no smaller than the valve outlet, flow by gravity with no valves, tees, or traps, and end in plain view no more than 6 inches above the floor, pan, or drain rim, with no threads on the end.
Thermal expansion tank
If a check valve, backflow preventer, or pressure-reducing valve closes off your supply, heated water has nowhere to expand, and IRC Section P2903.4 requires a means of controlling that pressure. Our guide to sizing and mounting a thermal expansion tank explains how to set its air charge to your house pressure before you install it on the cold line.
Venting and combustion air (gas)
Under the standard method in IRC Section G2407.5, the room needs at least 50 cubic feet of volume per 1,000 Btu/h of total appliance input, so a 40,000 Btu/h heater alone in a room needs about 2,000 cubic feet. Closets usually need louvered doors or outdoor air.
Gas sediment trap and shutoff
Where the appliance does not include one, IRC Section G2419.4 calls for a sediment trap (a tee with a capped nipple on the bottom) downstream of the shutoff valve and as close to the gas inlet as practical. The shutoff valve must sit in the same room, generally within 6 feet of the heater.
Seismic strapping
IRC Section M1307.2 requires water heaters in Seismic Design Categories D0, D1, and D2 (and townhouses in Category C) to be strapped in the upper third and lower third of the tank, with the lower strap at least 4 inches above the controls. In California, Health and Safety Code Section 19211 requires every residential water heater to be braced, anchored, or strapped.
What do gas and electric water heater installs require?
Gas and electric installs share the same water side (shutoffs, expansion control, T&P discharge, strapping) but split on energy. A gas unit adds fuel piping, a sediment trap, a vent, combustion air, and a draft check. An electric unit adds a dedicated 240-volt circuit, a proper disconnect, and one rule that ruins elements when skipped: fill before power. Before buzzing in that dedicated circuit, double check the tank’s pressure relief valve since a stuck or dripping one points to problems the new install won’t fix.
| Requirement | Gas tank | Electric tank |
|---|---|---|
| First shut-off | Gas control to OFF, close appliance gas valve, close cold water | Breaker OFF and tested dead, close cold water |
| Energy connection | Gas line with shutoff in same room, generally within 6 ft; sediment trap (IRC G2419.4) | Dedicated 240 V circuit rated at 125% of nameplate amps (NEC 422.13) |
| Venting | Vent connector to chimney or listed vent; connector rises toward the chimney with no dips | None for a standard resistance tank |
| Combustion air | 50 cu ft per 1,000 Btu/h, standard method (IRC G2407.5), or outdoor air | Not required |
| Garage placement | Ignition source 18 in. above floor unless listed flammable vapor ignition resistant (IRC G2408.2) | Elevation rules for electric tanks vary by inspector; ask before you set it on the floor |
| T&P discharge | Full size, gravity, ends 6 in. max above floor (IRC P2804.6.1) | Same |
| Expansion control | Required on closed systems (IRC P2903.4) | Same |
| Seismic strapping | Upper and lower thirds where required (IRC M1307.2) | Same |
| Start-up test | Soap-solution leak test, light per label, draft check at the draft hood | Tank full and air bled before breaker goes on |
| Typical add-on cost | Basic gas venting $300 to $500 (This Old House) | Switching fuel types: budget $1,500 to $2,000 extra for new electrical or gas lines (This Old House) |
On the garage row: many modern gas tanks are listed flammable vapor ignition resistant, so the 18-inch stand under old heaters is not always required. Read the rating plate first.

How do you install a gas water heater step by step?
To install a gas water heater, shut off the gas and cold water, drain and disconnect the old tank, set the new unit with strapping and a pan where required, connect water and the T&P line, reconnect the vent and gas with a sediment trap, fill the tank, leak test the gas, light it, and confirm the vent draws.
- Shut everything off. Turn the gas control knob to OFF, close the gas shutoff valve on the heater’s supply line, and close the cold water valve above the tank. Let the water cool first; it comes out scalding.
- Drain the tank. Open a hot faucet, run a hose from the drain valve to a floor drain or outdoors, and open the valve.
- Disconnect. Break the gas union with two wrenches, pull the vent connector, and disconnect the water lines and T&P pipe.
- Set the new tank. Use a drain pan where a leak would cause damage, keep listed clearances, and strap it where required.
- Connect water. Dielectric fittings or the specified connectors, cold to inlet, hot to outlet, and an expansion tank on the cold line if the system is closed.
- Run the T&P discharge. Full size, downhill all the way, no threads at the end, terminating 6 inches or less above the floor or drain.
- Reconnect the vent. Seat the connector on the draft hood, fasten each joint, and keep it rising toward the chimney with no dips or sags.
- Reconnect gas. Add a sediment trap ahead of the gas valve and use a new listed connector or hard pipe.
- Fill and bleed. Close the drain, open the cold supply, and run a hot faucet until no air comes out.
- Leak test, light, check draft. Brush soap solution on every gas joint (bubbles mean a leak; never use a flame), light per the label, and once the burner runs, hold a smoke source at the draft hood. Smoke should pull up the vent.
How do you install an electric water heater step by step?
To install an electric water heater, kill the breaker and test the wires dead, shut the cold water, drain and disconnect the old tank, set and strap the new one, connect water, expansion control, and the T&P line, fill the tank completely and bleed the air, then wire it and restore power. Power before water burns out the elements.
- Kill power and prove it. Switch the double-pole breaker OFF and confirm zero voltage at the junction box with a tester.
- Shut water and drain. Same as a gas unit.
- Disconnect. Photograph the wiring, then disconnect the two hot conductors and the ground, the water lines, and the T&P pipe.
- Set, strap, and plumb. Pan if required, cold to inlet, hot to outlet, expansion control if closed, and a code-compliant T&P pipe.
- Fill completely before power. Run a hot faucet until the flow is steady with no sputtering.
- Wire it. Land the two hots on the supply leads and the ground on the green screw, with a proper cable clamp. Size the breaker and wire to the nameplate under the National Electrical Code (NFPA 70), and use a lockable breaker or a disconnect within sight (NEC Section 422.31).
- Restore power. Set both thermostats alike and confirm hot water after recovery.
How long does it take to install a water heater?
A plumber replacing a tank in the same location usually spends about 1 to 3 hours on the job, per This Old House, plus time for the tank to fill and heat. A first-time DIYer should block most of a day. The swap is quick; freeing seized unions, fixing an old relief line, and adding missing code items is what eats the clock.
What stretches it: a sediment-packed tank that drains slowly, corroded nipples that snap, a taller new unit that misses the old connector and vent heights, and an inspection that is often a separate visit.

How much does it cost to install a water heater yourself vs hiring a pro?
Hiring a pro to install a tank water heater typically costs $1,200 to $2,300 all in, per This Old House using The Home Depot data. Doing it yourself saves the labor portion, roughly $300 to $800, but you still pay for the unit, parts, code add-ons, and the permit.
The full ranges are $1,200 to $2,300 for a tank, $2,500 to $3,500 for a heat pump, $2,100 to $4,000 for tankless, and $2,000 to $5,500 for solar. The tank line is the one DIYers compete with. This Old House breaks a complete tank install into a $600 to $1,000 unit, $300 to $800 in labor, $300 to $500 for venting on gas models, and $100 to $200 for water line connections. Code add-ons stack on top where required: an expansion tank at $40 to $150, earthquake strapping at $100 to $300, and a T&P valve at $20 to $200.
Switching from electric to gas adds $1,500 to $2,300 for new gas lines, per This Old House, and attic installs add $200 to $1,000. Our water heater replacement cost guide breaks the full bill down by size, fuel, and repair-versus-replace math.
What mistakes make a water heater install fail inspection?
Most failed water heater inspections trace to the safety lines, not the tank. The repeat offenders are a bad T&P discharge pipe, a missing sediment trap or expansion tank, a sagging vent connector, and straps placed over the controls. Each is cheap to get right the first time and annoying to fix after.
- Relief line: reduced size, uphill run, threaded end, or ending over 6 inches up (IRC P2804.6.1).
- No sediment trap on the gas line (IRC G2419.4).
- No expansion control on a closed system (IRC P2903.4).
- Vent connector dips, loose joints, or no rise toward the chimney.
- Straps missing, single, or within 4 inches of the controls (IRC M1307.2).
- Unpermitted work that a buyer’s inspector flags at resale.
How we sourced this
We reviewed the top-ranking install guides (The Home Depot, Hunker, HomeServe), then built the code section from primary text: the 2021 International Residential Code (Sections P2804.6.1, P2903.4, G2407.5, G2408.2, G2419.4, and M1307.2), NFPA 70 (NEC Sections 422.13 and 422.31), and California Health and Safety Code Section 19211. Cost figures come from This Old House’s 2026 installation cost guide, which bases its ranges on The Home Depot data. We excluded cost pages that named no data source. Local code editions and amendments vary. Reviewed October 2026.
Frequently asked questions
Can I install a water heater myself?
In many areas a homeowner may pull a permit and install a water heater in a home they own and live in, but rules vary by city and state, and some jurisdictions require a licensed plumber or gas fitter for any gas connection. An electric tank swap is the more reasonable DIY job; gas work is best left to a licensed pro.
Do I need a permit to replace a water heater?
In many jurisdictions, yes. Replacing a water heater usually counts as plumbing work that needs a permit and an inspection, even for a like-for-like swap. The inspector typically checks the T&P relief discharge line, thermal expansion control, venting and combustion air on gas units, the gas sediment trap, and seismic strapping where your area requires it.
How long does it take to install a water heater?
A plumber replacing a tank in the same spot usually needs about 1 to 3 hours of labor, per This Old House, plus the time to fill the tank and let it heat. A first-time DIYer should plan on most of a day, since draining, corroded fittings, and code fixes take longer than the swap itself.
How much does a plumber charge to install a water heater?
This Old House, using The Home Depot data, puts a complete tank install at $1,200 to $2,300, with labor making up roughly $300 to $800 of that and plumbers charging about $40 to $200 an hour. Gas units add basic venting at $300 to $500. Required code add-ons raise the bill further.
Do I need an expansion tank on a new water heater?
You need thermal expansion control if your water supply is a closed system, meaning a check valve, backflow preventer, or pressure-reducing valve stops heated water from expanding back into the main. IRC Section P2903.4 requires a means of controlling that pressure, and an expansion tank is the usual fix. This Old House prices it at $40 to $150.
Should you fill a water heater before turning it on?
Yes. Fill the tank completely and open a hot faucet until water runs steadily with no air before you turn on the gas or flip the breaker. On an electric heater, energizing an element that is not under water can destroy it right away, a failure called dry firing that manufacturer manuals warn against.
What size breaker does an electric water heater need?
NEC Section 422.13 treats a storage water heater of 120 gallons or less as a continuous load, so its branch circuit must be rated at least 125 percent of the nameplate current. A common 4,500-watt, 240-volt element draws about 18.75 amps, so the minimum works out to about 23.4 amps, and a 30-amp double-pole breaker with matching wire is the usual result.


