Every piping code has a table of maximum distances between supports. ASME B31.1 suggests 7 ft for a 1-inch steel water line, 14 ft for a 4-inch, 23 ft for a 12-inch. Plumbing codes say small copper tubing needs a hanger every 6 ft.

Those tables look like lookup data. They are really the output of two short beam formulas, and once you write them down in Python you can see which one actually controls the answer. Spoiler: for almost every pipe you will meet in a building, it isn't the stress.

Two limits on one beam

A straight pipe resting on evenly spaced supports is a continuous beam with a uniform load w: the pipe's own weight plus its contents (and insulation, if any). Two things go wrong as the span L grows.

Bending stress at the supports. For a continuous run, a common approximation for the support moment is M = wL²/10. The stress is σ = M/Z, where Z is the section modulus. Solve for the span that hits an allowable stress S:

L_stress = sqrt(10 · Z · S / w) 

Sag at midspan. For deflection, a conservative choice is the simply supported formula δ = 5wL⁴ / (384EI). Set δ to a limit (0.1 inch is the classic value behind B31.1-style tables) and solve:

L_sag = (384 · E · I · δ / (5 · w)) ^ (1/4) 

The maximum spacing is the smaller of the two.

Look at the exponents before writing any code. Stress grows with L², sag with L⁴. Doubling a span quadruples the stress but multiplies the sag by sixteen. That alone tells you which limit tends to arrive first.

The model

Section properties come from the outside diameter and wall thickness of the actual schedule, not from the nominal size. Units are inches and pounds throughout, converted to feet only for printing.

import math E_STEEL = 29.0e6 # psi RHO_STEEL = 0.2836 # lb/in^3 RHO_WATER = 62.4 / 1728 def section(od, wall): """Moment of inertia I (in^4), section modulus Z (in^3), metal and bore areas (in^2).""" d_in = od - 2 * wall I = math.pi / 64 * (od**4 - d_in**4) Z = 2 * I / od return I, Z, math.pi / 4 * (od**2 - d_in**2), math.pi / 4 * d_in**2 def max_span(od, wall, full=True, s_allow=5000, sag_limit=0.1, E=E_STEEL, rho=RHO_STEEL): I, Z, a_metal, a_bore = section(od, wall) w = a_metal * rho + (a_bore * RHO_WATER if full else 0.0) # lb/in l_stress = math.sqrt(10 * Z * s_allow / w) # M = wL^2/10 l_sag = (384 * E * I * min(sag_limit, 0.5 * od) / (5 * w)) ** 0.25 return l_stress / 12, l_sag / 12, w * 12 # ft, ft, lb/ft PIPES = {"1": (1.315, 0.133), "2": (2.375, 0.154), "4": (4.500, 0.237), "6": (6.625, 0.280), "8": (8.625, 0.322), "12": (12.750, 0.406)} for nps, (od, wall) in PIPES.items(): s_full, d_full, w_full = max_span(od, wall, full=True) s_empty, d_empty, w_empty = max_span(od, wall, full=False) print(f'NPS {nps:>2}: water {min(s_full, d_full):5.1f} ft (stress {s_full:4.1f}, sag {d_full:4.1f}) | ' f'empty {min(s_empty, d_empty):5.1f} ft') 

The pipe data is standard-weight (Schedule 40) carbon steel from ASME B36.10M. The 5,000 psi allowable is a common screening value for carbon-steel dead-weight spans.

The output

NPS 1: water 8.6 ft (stress 16.4, sag 8.6) | empty 9.0 ft NPS 2: water 11.4 ft (stress 21.4, sag 11.4) | empty 12.4 ft NPS 4: water 15.5 ft (stress 28.6, sag 15.5) | empty 17.1 ft NPS 6: water 18.4 ft (stress 33.5, sag 18.4) | empty 20.9 ft NPS 8: water 20.8 ft (stress 37.3, sag 20.8) | empty 23.9 ft NPS 12: water 24.8 ft (stress 43.8, sag 24.8) | empty 29.2 ft 

Three things jump out.

Sag governs every row. The stress-limited span is roughly twice the sag-limited one. For the 4-inch water line, the stress at a 15.5 ft span is only about 1,470 psi, less than a third of the allowable. You could cut the allowable stress in half and the answer would not move.

The empty-pipe column reproduces the code table. B31.1's suggested spans for steam, gas and air service are 9, 13, 17, 21, 24 and 30 ft for these sizes. The model gives 9.0, 12.4, 17.1, 20.9, 23.9 and 29.2. Nobody hard-coded those numbers. They fall out of a 0.1-inch sag limit.

Water costs you a couple of feet. Filling the 4-inch pipe takes the load from about 11 to 16 lb/ft and the span from 17.1 to 15.5 ft. B31.1 lists 14 ft for water service, a bit tighter than the bare calculation, which is what you would expect from a table that has to cover real installations with fittings and some insulation.

The hydrotest trap

The last point has a practical consequence. Gas and compressed-air lines are often pressure-tested with water. A support layout designed for the empty line, spaced at about 17 ft for 4-inch pipe, is over-spanned for the few days it is full of water.

The fix is cheap if you do it early: run the function with full=True and full=False and take the shorter span.

def governing_span(od, wall, **kw): spans = [min(max_span(od, wall, full=f, **kw)[:2]) for f in (True, False)] return min(spans) print(f"{governing_span(4.5, 0.237):.1f} ft") # 15.5 ft for 4-inch Sch 40 

Same code, copper tubing

Swap the material constants and the function works for copper. Use E = 17e6 psi and rho = 0.323 lb/in³. A 3/4-inch Type L tube (OD 0.875 in, wall 0.045 in) full of water gives a sag-limited span of about 5.8 ft, close to the 6 ft that plumbing codes use for copper 1-1/4 inch and smaller.

The fourth power is easy to see here too. At 6 ft that tube sags about 0.11 inch. At 12 ft it sags about 1.8 inches, roughly sixteen times more.

What the model leaves out

This is a screening tool for straight, uniformly loaded runs. It does not handle:

  • concentrated weights such as valves, flanges or vertical drops, which need their own supports
  • thermal expansion, anchors and guides
  • vibration; a natural-frequency check is a separate calculation
  • plastic pipe, where stiffness depends strongly on temperature and creep matters

For any real design, the governing ASME B31 section, MSS SP-58 and the project's pipe stress analysis still decide.

Takeaways

  • Write both checks, always. They answer different questions, and the smaller span wins.
  • Expect sag to govern on small and medium pipe. Stress becomes interesting only with heavy contents, thin walls or much larger diameters.
  • Check the water-filled case even for gas lines.
  • Use real schedule dimensions. The nominal size is a label, not a geometry.

Your turn: what is the longest unsupported span you have seen on a job, and what was in the pipe? Post the size and schedule in the comments and I'll run it through the model.