Short answer
It can, when it puts the pipes on the warm side of the insulation and stops the cold air that blows across them. Pipes freeze where cold air reaches them: rim joists, crawlspaces, exterior walls and unheated garages. Unprotected pipes in cold spaces start to freeze around 20°F outside, sooner in a draft. Spray foam on the rim joist, the crawlspace walls or the outside of the wall cavity brings those pipes inside. What foam can't do is heat a building: a pipe in a house or camp with the heat off will still freeze.
Key points
- Unprotected pipes in unconditioned spaces start to freeze around 20°F outdoors; moving cold air freezes them at warmer temperatures.
- The lasting fix is location: insulate the crawlspace walls and rim joist instead of the floor above, so the pipes are inside.
- In an exterior wall, put as much insulation as possible between the pipe and the outside.
- Closed-cell foam air-seals the cracks at the sill and rim joist that blow cold air onto pipes.
- Plastic pipe needs care: thinner foam passes near it, and a compatibility check for CPVC.
- Insulation slows heat loss; it doesn't make heat. An unheated building needs its water drained or the heat left on.
Where pipes freeze
Pipes freeze where cold air reaches them. The International Code Council, drawing on IBHS research, names the usual places: uninsulated attics, crawl spaces and outside walls, especially where cracks or openings let cold outside air flow across the pipes. Chubb's risk consultants add a spot people miss: the sill plate and rim board along the top of the foundation, where the house sits on its basement walls.
Typical trouble spots in Western Pennsylvania houses: a kitchen sink on an outside wall, a bathroom over a garage or crawlspace, a laundry line along the rim joist, and anything in an unheated garage or addition.
The 20°F rule, and why drafts break it
Field tests by the University of Illinois Building Research Council found that uninsulated pipes in an unconditioned attic began to freeze when the outdoor temperature fell to 20°F or below, and that figure became the common alert threshold. The same research is clear that it is not a guarantee: pipes exposed to moving cold air, through cracks in an outside wall or a lack of insulation, can freeze at warmer temperatures.
That's why air sealing matters as much as insulation. A pipe in still air can ride out a cold night that the same pipe in a draft from a gap at the sill would not.
Put the pipes inside the insulation

The fix that lasts is location. The ICC notes that pipes in outside walls or unconditioned spaces can sometimes be protected by placing them inside the building's thermal envelope, and DOE's Building America Solution Center says that when a pipe has to run in an exterior wall, as much cavity insulation as possible should sit between the pipe and the outside.
Spray foam is good at both:
- Crawlspaces. Insulating the floor above a crawlspace leaves the pipes below it, in the cold. Insulating the crawlspace walls and rim joist instead puts the pipes inside (see crawl space spray foam).
- Rim joists and sills. Closed-cell foam on the rim joist insulates and air-seals the band of framing that pipes often run beside, and closes the cracks that blow cold air on them.
- Exterior walls. In an open wall, foam goes against the sheathing behind the pipe, so the pipe ends up on the warm side.
- Floors over garages. Pipes in the floor of a room over a garage sit next to the garage's cold air; foam on the garage ceiling and at the rim keeps them on the warm side (see cold bonus room over a garage).
Plastic pipes: CPVC and PEX
Two cautions apply when foam goes near plastic plumbing. The first is heat: closed-cell foam gets warm as it reacts, and BASF's application guidelines note that wiring and plastic pipes have lower temperature limits, so thick applications near them call for thinner passes with cooling time, flash coats or physical protection.
The second is chemistry, for CPVC (usually cream or tan). Lubrizol, which makes the CPVC compounds behind FlowGuard pipe, says to get assurance from the spray foam manufacturer that its formulation is compatible with CPVC, and to remove both the foam and the pipe in any area where spray foam gets wet. So tell your installer what the pipe is before anyone sprays near it, and ask which product will be used.
What insulation can't do
Insulation slows heat loss; it doesn't make heat. The ICC's winter safety advice says insulation keeps attics, basements and crawl spaces warmer, which only works while the house is heated. In a building with the heat off, a hunting camp in January or a house left empty, the pipes reach outdoor temperature sooner or later however well the building is insulated. Those buildings need their water drained or the heat kept on.
For pipes that have to stay in unconditioned spaces, DOE's Building America Solution Center suggests thermostatically controlled electric heat tape in freezing climates, along with pipe insulation. The ICC's list also includes the outdoor basics: remove, drain and store garden hoses before winter.
Want a number for your own project? Price My Project, book a free visit or call (814) 208-3478.
Read next: Crawl Space Spray Foam: Vented vs Sealed Crawls · Rim Joist Spray Foam: How Much and Why It Matters · Hunting Camp and Cabin Insulation in Pennsylvania.
FAQ
At what temperature do pipes freeze?
The research behind the common rule found uninsulated pipes in unconditioned spaces start to freeze when it falls to about 20°F outside. Pipes in a draft can freeze at warmer temperatures.
Should spray foam be sprayed directly over water pipes?
It works better behind them, against the sheathing, so the pipe sits on the warm side and stays reachable for repairs. Near plastic pipe the foam goes on in thinner passes.
Do I still need pipe insulation sleeves?
For pipes that stay in unconditioned spaces, yes. On CPVC, Lubrizol recommends fiberglass, polyethylene, polyiso or phenolic pipe insulation and warns that foamed rubber may contain incompatible plasticizers.
Will spray foam keep pipes from freezing in a camp or an empty house?
Not with the heat off. Insulation slows heat loss but doesn't create heat, so drain the water or keep the heat on.
Sources
- International Code Council: Build It to Code to Minimize Damage from Frozen Water Pipes (cites IBHS)
- Multnomah County: frozen pipe guidance citing University of Illinois Building Research Council tests
- Chubb: How to prevent pipes from freezing in the winter
- U.S. DOE Building America Solution Center: Pipes in Exterior Walls
- U.S. DOE Building America Solution Center: Insulating Plumbing Pipes
- International Code Council, Building Safety Month: Water Safety in Winter (brochure)
- BASF: WALLTITE Series HFO Closed-Cell SPF Application Guidelines (Feb. 9, 2023; distributor-hosted copy)
- Lubrizol: FBC System Compatible Program, recent updates (April 4, 2022)
- Lubrizol: FBC System Compatible Program, changes to the website (Aug. 6, 2013)
- Lubrizol: FBC System Compatible Program updates (July 29, 2020)
