Stand in front of your water heater and look up. Two pipes go into the top, a third points toward the floor, and there may be a small tank or a gas line in the mix. Most people know the tank itself ,and almost nothing about the plumbing around it, which is where the leaks, the odd noises, and the failed inspections come from.
Water heater piping is simpler than it looks: cold in, hot out, plus a few safety lines that must never be blocked. This guide walks through each pipe, the order the parts go in, what the plumbing codes care about, and a ten-minute check you can run on your own setup.

A Quick Tour of Water Heater Piping
Cold water comes in at the top and runs down a dip tube to the bottom of the tank, where it gets heated. Hot water rises and leaves through the other top connection. Everything else is there to protect the tank, the pipes or you.
Pipe or part | Where it is | What it does | Watch for |
Cold inlet | Top, marked blue or "COLD" | Feeds the tank | Hot and cold reversed |
Hot outlet | Top, marked red or "HOT" | Sends hot water to the house | Leaks at the fitting |
T&P valve and discharge pipe | Top or side, pipe runs down | Releases water if pressure or temperature gets too high | Capped, threaded or trapped line |
Drain valve | Bottom of the tank | Lets you flush out sediment | Slow drips |
Expansion tank | Tee on the cold line | Absorbs pressure as water heats | A waterlogged tank |
Gas line (gas heaters) | Near the bottom | Feeds the burner | Anything you smell |
Labels fade on older tanks. If yours are gone, run hot water at a tap for a few minutes, then touch the two top pipes. On a heater that's been working, the warm one is your hot outlet. Mixing them up is the classic mistake in DIY water heater piping, and it quietly shortens the tank's life.
The Right Order of Parts on the Cold Side
Order matters, because it decides whether you can service the heater without shutting off the whole house. From the supply toward the tank, the sequence is usually:
A shutoff valve, so you can isolate the heater.
The expansion tank tee, if your home needs one. It goes after the shutoff so it's never cut off from the heater.
A union or flexible connector, so the tank can come out later without cutting pipe.
A dielectric fitting where copper meets the steel threads on the tank, which slows the corrosion that two different metals cause in wet conditions.
One tip from heater makers: don't solder pipes while they're attached to the tank. The inlet and outlet fittings contain non-metallic parts that heat can damage, so sweat fittings together first and screw the assembly on.
What Water Heater Piping Is Made Of
Whatever you choose, the heater's manual wins. It lists the connection size (usually 3/4 inch) and any limits on plastic near the tank.
Material | Good at | Watch out for |
Rigid copper | Long life and heat tolerance | Needs soldering and dielectric fittings |
Flexible stainless connectors | Forgiving of misaligned pipes | Can kink, and can pinhole in aggressive water |
PEX | Easy to run through walls | Not allowed right at the heater in many areas |
CPVC | Made for hot water | Check the heater manual before using plastic near the tank |
PVC | Cold water and drains | Never use it for hot water |
Insulating the hot line saves a little energy. The cold line doesn't need it, since you want that water at room temperature before it enters the tank.
Water Heater Piping and PEX: What the 18-Inch Rule Says
This is the question that starts forum arguments. The Uniform Plumbing Code (UPC) says PEX can't be installed within the first 18 inches of piping connected to a water heater, so most plumbers start with 18 inches of metal pipe or a flexible connector. Gas heaters add a second rule: keep PEX at least 6 inches from the flue. Some manufacturers allow direct PEX connections on electric heaters with approved adapters, so it varies by code and by brand.
If you aren't sure, ask the installer to show you the local code or the manufacturer's instructions in writing. Our guide to PEX plumbing problems covers what's worth worrying about with this pipe.

The Pipe People Forget: the T&P Discharge Line
The temperature and pressure relief valve is the heater's last line of defense, and its discharge pipe has strict rules. Under the International Plumbing Code (IPC), the line should:
Be at least as large as the valve outlet, and stay that size all the way down
Have no valves, no tee fittings and no threaded end
Run downhill by gravity, with no traps
Stop no more than 6 inches above the floor, a floor drain or a waste receptor, or run outdoors
End where people can see it, and serve only that one valve
Never cap or plug it. A capped relief line can turn a stuck valve into a tank failure. Rules also vary: the IPC allows the line to end in a drain pan, while California's plumbing code prohibits that. If it drips, don't ignore it, and read what a whistling water heater can tell you about pressure.

Do You Need an Expansion Tank?
Water expands when it heats. In an open system, the extra volume pushes back into the street main. If your house has a check valve, pressure-reducing valve or backflow preventer, it's a closed system, and the pressure has nowhere to go. The IPC requires a thermal expansion tank on the cold supply, downstream of those devices.
Signs of trouble include dripping faucets, toilets that refill on their own and a relief valve that weeps. The tank's air pre-charge should match your house's static water pressure, which you can check with a gauge. Water spitting from the tank's air valve usually means a torn bladder. Pressure above about 80 psi is also hard on faucets and fittings, which is one reason many homes have a pressure-reducing valve in the first place. A steady hum in the pipes can be another clue, and our guide on whether humming water pipes are dangerous explains what it might mean. Don't count on the T&P valve to handle expansion. It's a safety device, not a pressure regulator.
Gas, Tankless and Two-Heater Setups
Water heater piping on a gas unit adds a gas line with its own shutoff valve and, usually, a sediment trap that catches debris before it reaches the burner. It also adds a vent pipe that needs clearance from anything flammable. That's licensed-pro territory, and if you ever smell gas, leave the house and call the gas utility.
Tankless units are different. They normally don't need an expansion tank unless a storage tank is added in a closed system, and most manufacturers want metal pipe at the unit. Installers also add isolation valves so the heat exchanger can be flushed. If you have two heaters, piping them in parallel lets them share the load. One manufacturer warns that piping them in series can wear out the first heater sooner.
Check Your Own Water Heater Piping in 10 Minutes
Grab a flashlight and walk around the heater once. Here's what to look for in your water heater piping.
Hot and cold: The labels should match the lines, and the hot outlet should be the warm one.
Relief line: It should exist, point down, and be open at the end.
Shutoff valve: Make sure it's accessible and not crusty.
Fittings: Look for green crust, white mineral trails or fresh drips. Our guide to a water heater leaking from the bottom helps you sort the causes.
Floor and pan: Check for dampness or a blocked pan drain. If you find any, see hidden water damage after a plumbing leak.
Age and symptoms: If the heater is old and acting up, the one part behind most water heater failures is worth a look. Fold all of this into your general plumbing maintenance routine.
[AUTHOR NOTE: Add 2 to 3 sentences from a real water heater job: something you found wrong in the piping and how you fixed it. A photo of your own setup works too. Delete this note before posting.]
When to Call a Plumber
Call one for anything involving gas, soldering, relief-line rerouting, a pressure-reducing valve, or a heater that needs a permit. Most areas require a permit and inspection for a replacement, and a licensed plumber handles the paperwork. Our guide on how to hire a plumber covers what to ask before they start.
FAQ
How often should I check water heater piping? Once a year, ideally in the fall, and any time you see a drip, hear a knock or smell gas.
Which water heater pipe is hot? The one labeled red or "HOT," and it's the warm one after the heater has run. The cold inlet has a blue ring or label.
Can I cap the T&P discharge pipe? No. It has to stay open and unblocked.
Can I connect PEX directly to a water heater? Often not. UPC requires 18 inches of metal first, and gas heaters add flue clearance rules.
Does water heater piping need insulation? The hot line benefits from it. The cold line doesn't need it.
Final Thoughts
Good water heater piping is mostly about order, material and the pipes you can't see doing their job. Check yours once a year, and when anything involves gas, soldering or the relief valve, pay the plumber.
About Mubashir Yaqoob
Mubashir Yaqoob researches and writes practical home repair guides for Home Repair Manual, focused on translating technical roofing, plumbing, and maintenance information into clear advice for homeowners.
View all posts by Mubashir Yaqoob