Hot water that holds steady and then runs cold in the middle of a shower is one of the most common calls a plumber gets, and it almost never means the water heater is dead. It means one part of the system stopped carrying its share of the heat, or cold water found a way into the hot line. On an electric tank that is usually a burned-out lower element. On a gas unit it is the control valve or thermostat. On a tankless it is flow. And sometimes the heater is fine and the problem is a crossed connection or a mixing valve out in the plumbing. This page walks every one of those, for tank and tankless, so you can match the symptom to the cause before you spend a dime.
First, is it the heater or the plumbing?
Before you blame the tank, notice the pattern, because it narrows the cause fast. Swings at one fixture point at that fixture. Hot-then-cold everywhere points at the heater. Lukewarm only during heavy morning use is a capacity problem. And on a tankless, cold bursts that track how far you open the tap are about flow. Match your case to the grid below, then jump to that section.
Hot then cold everywhere
Whole-house swings on an electric tank almost always trace to a dead lower element or lower thermostat, so only the top of the tank heats. Sediment on the bottom does the same thing more gradually.
Lukewarm or wandering
On gas, a control valve that will not hold a steady flame or a failing thermostat causes fluctuating or lukewarm output and burner dropouts. This one is a licensed-pro diagnosis.
Cold bursts with flow
Tankless swings track flow: a cold water sandwich between draws, or dropping under the minimum activation flow so the burner cuts out. Open the tap wider and the heat usually returns.
One fixture acts up
If it is one faucet, or warm water comes from the cold tap, suspect a crossed connection through a failed faucet cartridge, or a thermostatic mixing valve stuck on scale.

Leave the gas valve to a pro
A gas control valve that will not hold a steady flame is not a homeowner fix. Diagnosing and replacing it is licensed plumber or gas fitter work, because a mistake there risks a gas leak or carbon monoxide. Everything else on this page you can investigate yourself with the power or gas off first.
Electric tanks: it is usually the lower element
An electric water heater has two heating elements and two thermostats stacked in the tank, and they do not run at the same time. The upper thermostat heats the top of the tank first so you get hot water quickly, then it hands power down to the lower element, which does most of the day-to-day heating and keeps the whole tank hot. When the lower element or its thermostat fails, only the top third or so of the tank ever gets hot. You draw that small hot layer, it empties fast, and the cold water sitting in the bottom two-thirds comes through until the upper element slowly reheats a fresh batch at the top. That stop-start cycle is exactly the hot, then cold, then warm-again pattern most people describe.
The test is quick. Kill the breaker, pull the lower access cover, fold back the insulation, and put a multimeter across the element terminals for continuity. A good element reads continuity; an open one reads none and needs replacing. If the element checks out, test the thermostat behind it the same way. This is a reasonable homeowner repair as long as the power stays off while you work, but if you are not comfortable inside the wiring compartment, hand it to a plumber.
Why does the top of my tank get hot but the water still runs cold?
That is the signature of a working upper element and a dead lower one. The top heats, gives you a short run of hot, then you are into the unheated bottom of the tank. Test the lower element first; it is the part that carries the tank once the top is up to temperature.
Sediment and dip tubes: the slow-building causes
Two tank problems creep in over years rather than failing overnight. The first is sediment. In hard-water areas, calcium and magnesium settle on the bottom of the tank, piling up over the lower electric element or across the burner path on a gas unit. That mineral bed insulates the heat from the water, so the element or flame runs but the water above it never fully heats, and you get inconsistent temperature plus popping and rumbling as trapped water flashes to steam underneath. Flushing the tank once a year clears light sediment. A bed that has baked hard may not flush clean, and a heavily scaled element usually has to be pulled and replaced.
The second slow failure is the dip tube, the plastic tube that carries incoming cold water down to the bottom of the tank so it heats before rising to the outlet. When it cracks, shortens with age, or breaks off, cold water dumps into the top of the tank right where the hot outlet draws from. The cold mixes straight into your hot supply, giving you lukewarm water and fast temperature swings, and you burn through the tank far quicker than its size should allow. The clincher is finding small white or gray plastic flakes in your aerators and showerheads as the tube disintegrates. The tube itself is a cheap part, but on a tank past ten or twelve years old, a broken dip tube is often the nudge to replace the whole heater.

The thermostat deadband and gas valve
Some swing is built in and normal. Every water heater thermostat has a deadband, the range it lets the temperature drop below your setpoint before it refires the element or burner. On a typical water heater that deadband runs around fifteen to twenty degrees, so a tank set to 120 might coast toward the low 100s before the heat kicks back on. That is intentional; it keeps the unit from short cycling. But a wide deadband, or a setpoint set too low to begin with, shows up as noticeable drift during a long draw. Nudging the setpoint up a few degrees often takes the edge off before you assume something is broken.
On a gas tank, the gas control valve reads the thermostat and meters gas to the burner to hold your setpoint. When it starts to fail, it stops regulating a steady flame, so the water temperature wanders or runs lukewarm and the burner may drop out and relight. A failing thermostat on a gas unit does much the same. Both symptoms overlap with a dead element on an electric tank, which is why fuel type matters when you diagnose. The difference is what you do next: the gas control valve is not a homeowner repair. Diagnosing and replacing it belongs to a licensed plumber or gas fitter, since the failure modes touch gas supply and combustion safety directly.
Symptom: swings on an electric tank
Start at the lower element and lower thermostat with a multimeter. A dead lower circuit means only the top of the tank heats, the classic hot-then-cold cycle.
Symptom: lukewarm or wandering on gas
Suspect the gas control valve or thermostat not holding a steady flame. Do not open the valve yourself; this is a licensed-pro diagnosis because of the gas and combustion risk.
Symptom: gradual, with noise and hard water
Think sediment. Flush the tank, and if a scaled electric element does not recover, pull and replace it. Set an annual flush going forward.
Symptom: lukewarm plus plastic bits in aerators
That is a broken dip tube letting cold dump at the top. Replace the tube, or the heater if it is already near the end of its life.
When the heater is fine: crossed connections and mixing valves
Sometimes the tank is healthy and the trouble lives in the plumbing. The most common version is a crossed hot and cold connection. Single-handle faucets have tiny check valves inside the cartridge that keep the hot and cold sides apart. When one fails, usually in a kitchen or laundry faucet, or through a bidet or portable washer added to the line, cold water crosses into the hot line and drags the temperature down across the whole house, not just at that fixture. The tell is warm water from a tap set fully to cold, or hot water that never gets properly hot.
There is a simple test. Shut off the cold supply valve feeding the water heater and open a hot tap. With the heater isolated on the supply side, hot water should stop within a few seconds once the line drains. If water keeps running, cold is crossing into the hot side through a failed fixture, and the fix is the bad cartridge, not the heater. A related culprit is a thermostatic mixing valve, which some homes use to blend tank water down to a safe delivery temperature. In hard water those valves scale up, stick, and respond sluggishly, so the temperature creeps up and then drops suddenly. Descaling or rebuilding the valve fixes it.
The cold-supply shutoff test
If shutting the cold supply into the water heater does not stop hot water from flowing at a tap, you have a crossover somewhere in the plumbing. Chase the faucet cartridges and any add-on fixtures before you replace anything on the heater itself.
Undersized tanks and recirculation loops
An undersized tank does not fluctuate randomly; it runs hot and steady and then falls off a cliff during heavy use, classically the morning rush when showers, the dishwasher, and laundry overlap. The number to look at is the first-hour rating, not the gallons on the label. First-hour rating is the tank capacity times about 0.7, plus the recovery rate in gallons per hour, and it tells you how much usable hot water the heater delivers in the first hour of hard use. Because a gas tank recovers around 20 to 30 gallons an hour and an electric one only about 13 to 21, an electric tank of the same size feels small much sooner. If your cold spells line up with peak demand and the heater is otherwise healthy, the answer is more first-hour rating: a larger tank, a faster-recovery unit, or a tankless.
Homes with a hot water recirculation loop add one more possibility. A recirculation pump on an aquastat holds the loop within a set band, commonly around 100 to 105 degrees on the return line, so hot water waits at the tap. If that aquastat is set below the tank temperature, or a comfort-valve crossover opens at the wrong point, the delivered temperature can wander because the loop keeps blending cooler return water back in. You cannot get 125-degree water from a 120-degree tank, and the numbers on an aquastat are a rough guide, not a precise reading. If your swings started after a recirculation system went in, have the loop settings checked against the tank setpoint first.
Fluctuating hot water feels like a failing appliance, but it is almost always one traceable part: a dead element, a bed of sediment, a broken dip tube, a crossed line, or a tankless dropping under its minimum flow. Match your pattern to the section above, kill the power or gas before you open anything, and hand the gas valve and any crossover you cannot chase to a plumber. Most of the time the heater has years left in it once the one bad part is sorted.
Frequently asked
Why does my water go from hot to cold and back again?
On an electric tank, the most common reason is a dead lower heating element or lower thermostat. An electric water heater has two elements and two thermostats. The upper thermostat heats the top of the tank first, then hands power down to the lower element to heat the rest. If that lower element or its thermostat quits, only the top third of the tank ever gets hot. You draw that hot layer, it runs out fast, and the cold below comes through until the upper element catches up. That is the classic hot, then cold, then warm cycle. On a gas unit, the same symptom usually points at a gas control valve not holding a steady flame or a failing thermostat. Either way it is a heat-source problem, and on an electric tank the lower element is where you start looking.
Can sediment in the tank cause temperature swings?
Yes, and it is one of the most overlooked causes in hard-water areas. Calcium and magnesium settle to the bottom of the tank over time and pile up on top of the lower heating element or over the burner flame path on a gas unit. That layer acts like insulation between the heat and the water, so the element runs but the water below it barely warms. The result is inconsistent temperature and popping or rumbling noises as water flashes to steam underneath. Flushing the tank once a year clears light sediment. If the bed is baked on hard, a flush may not fully restore it, and a badly scaled electric element often needs to be pulled and replaced along with the flush.
What are the signs of a broken dip tube?
A dip tube is the plastic pipe that carries incoming cold water down to the bottom of the tank so it heats before rising. When it cracks, shortens, or falls off, cold water dumps into the top of the tank where the outlet pulls hot water out. That cold mixes with the hot on the way to your taps, so you get lukewarm water and quick temperature swings. Two other tells go with it: you run out of hot water much faster than the tank size should allow, and you start finding small white or gray plastic flakes in your aerators and showerheads as the tube disintegrates. Dip tubes are cheap and easy to replace, but on a tank past ten or twelve years old it is often the moment to weigh a full replacement instead.
Why does my tankless water heater run hot then cold?
Two tankless-specific things cause this. The first is the cold water sandwich. When you shut the hot off and turn it back on soon after, the water still in the pipe comes through hot, then a slug that cooled while the burner was off comes through cold, then the freshly heated water arrives hot again. You feel a cold sandwich between two hot layers. It is normal tankless behavior, worst with short on-off draws. The second is dropping below the minimum activation flow. A tankless needs a minimum flow, commonly around half a gallon per minute, before the burner will fire. Throttle a faucet down or run a low-flow fixture and the flow can fall under that threshold, the burner drops out, and you get cold. Opening the tap a little more usually brings the heat back.
Could crossed hot and cold pipes be the problem?
It is a real and sneaky cause, especially if the swings showed up right after a fixture was replaced or a new appliance was plumbed in. Single-handle faucets have small check valves inside the cartridge that keep hot and cold apart. When one fails, cold water crosses into the hot line and pushes the temperature down across the whole house, not just at that fixture. The giveaway is warm water from a tap set fully to cold, or hot water that never quite gets hot. To test it, shut off the cold supply into the water heater and open a hot tap. If water still flows, cold is crossing into the hot side, and the failed fixture is the culprit rather than the heater.
How do I know if my water heater is just too small?
An undersized tank does not swing randomly. It runs steady and hot, then goes lukewarm during heavy use, typically the morning rush when showers, laundry, and the dishwasher overlap. The number that matters is the first-hour rating, not the gallon size on the label. First-hour rating is the tank capacity times about 0.7 plus the recovery rate in gallons per hour, and it tells you how much hot water the heater can actually deliver in the first hour of hard use. A gas tank recovers around 20 to 30 gallons an hour, an electric one only about 13 to 21, which is why electric tanks feel small faster. If your cold spells line up with peak demand and the heater is otherwise healthy, you need more first-hour rating: a bigger tank, a higher-recovery unit, or a tankless.
When should I call a plumber instead of fixing it myself?
Testing a lower element with a multimeter, flushing sediment, or swapping a dip tube are reasonable homeowner jobs if you kill the power or gas first. Anything touching the gas control valve is not. A gas valve that will not hold a steady flame needs a licensed plumber or gas fitter, both because the diagnosis is specialized and because a mistake risks a gas leak or carbon monoxide. Call a pro too if you have ruled out the tank and suspect crossed connections, a failing mixing valve, or a recirculation loop set wrong, since those hide in the plumbing rather than the heater. And if the tank is past ten or twelve years old and giving you trouble, get a replacement quote before you sink money into a unit near the end of its life.