Framing calculator

Stair Railing Calculator

A stair railing calculator that works out everything a stair railing needs, the handrail length along the slope, the number of balusters with a code-safe gap, the newel posts and the cost, for wood, metal or cable rail. Enter the total rise and run of the stair, and the calculator follows the slope, checks the 4-inch sphere rule and prices the job, so no opening is wide enough for a child to slip through.

  • Free to use
  • No sign-up
  • Formula and sources shown
Stair Railing Calculator

Got the number? Save it before it gets lost.

A result on a screen is easy to lose. Save this estimate in the app and it stays with the project, ready when you order.

Save this estimate in the app
105

Vertical distance from the lower floor to the upper floor.

140

Horizontal distance the stair covers. Get it from the stair calculator if you know risers and treads.

One side for a stair against a wall, two sides for an open stair.

1.25

1¼ in is standard for wood balusters, ½ in for iron.

3.5

Code limit is under 4 in (IRC R312). 3½ in is the default, giving margin for balusters that are not perfectly straight.

Cable rail costs more per foot but needs no balusters. Prices are US planning ranges for 2026.

6

Grip extension past the top and bottom risers. 0 for a rail that stops at the newels.

Balusters needed

37

Actual gap 3.48 in, under the 4 in code limit ✓

Handrail length

15.58 ft

Slope / angle

14.58 ft · 36.9°

Newel posts

3

Balusters per side

37

Materials cost

$832

Risers (at 7½ in)

14

Handrail height is 34–38 in from the nosing line (IRC R311.7.8). Buy the next stock length up for the handrail.

Turn this result into a priced plan

Save it to a project, add the rest of your materials, and send a client-ready quote. No retyping, no spreadsheet, no lost numbers.

Open this calculator in the app

Formula

Slope length = √(rise² + run²); Handrail = slope + 2 × overhang; Balusters = ceil(slope ÷ (baluster width + max gap)); Gap must stay under 4 in (IRC R312)

Worked example. A stair with 105 in of total rise and 140 in of total run, railed on one side in wood: the slope is √(105² + 140²) = 175 in (14.58 ft) at 36.87°, and the handrail is 175 + 12 = 187 in (15.58 ft). With 1¼ in balusters and a 3½ in maximum gap, it needs 37 balusters at an actual gap of 3.48 in, under the 4 in code limit, plus 3 newel posts, for a total of about $832.

A stair railing has to follow the slope, and guessing the baluster count leaves gaps a 4 in sphere can pass, which fails code. This calculator works the slope out from your rise and run: a 105 in rise over 140 in of run gives a 175 in slope at 36.87°, needing a 187 in (15.58 ft) handrail, 37 balusters at a 3.48 in gap, 3 newel posts, and about $832 in wood materials. Every baluster is counted to keep the clear gap under 4 in, and the page checks the code and prices the job as it goes.

Key takeaways

  • •Default stair: 105 in rise, 140 in run → 175 in slope (14.58 ft) at 36.87°, handrail 187 in (15.58 ft) with 6 in overhang each end.
  • •Balusters: 37 per side at an actual gap of 3.48 in, under the 4 in code limit (IRC R312, the 4-inch sphere test).
  • •Newel posts: 3 per side, top, bottom, plus one about every 6 ft of handrail.
  • •Cost (wood, one side): about $832, $187 handrail, $296 balusters, $255 newels, $94 bottom rail. Two sides: about $1,663.
  • •Handrail height is 34–38 in from the nosing line (IRC R311.7.8); handrails are required on stairs with 4+ risers.
  • •Guards are required when the total rise is over 30 in (IRC R312.1), at least 36 in high on landings.
  • •Baluster count = ceil(slope ÷ (baluster width + max gap)). Always round up. Rounding down breaks the code.
  • •Buy the next stock length up: a 15.58 ft handrail need takes a 16 ft stock length.

How to use the stair railing calculator

  1. Enter the total rise. The vertical distance from the lower floor to the upper floor, in inches.
  2. Enter the total run. The horizontal distance the stair covers, in inches. If you know the risers and treads instead, use the stair calculator to get the rise and run first.
  3. Choose how many sides are railed: one side for a stair against a wall, two sides for an open stair.
  4. Enter the baluster width: 1¼ in is standard for wood balusters, ½ in for iron.
  5. Set the maximum clear gap: 3½ in is the default, giving margin under the 4 in code limit.
  6. Choose the material: wood, metal balusters, or cable rail. Cable needs no balusters but costs more per foot.
  7. Set the handrail overhang: 6 in at each end is the default grip extension past the top and bottom risers.
  8. Read the handrail length, the baluster count with the actual gap, the newel posts and the cost. Then check the gap is under 4 in.

Worked examples

1. The default: 105 in rise, 140 in run, one side, wood

  • Slope length: √(105² + 140²) = √30,625 = 175 in (14.58 ft)
  • Stair angle: arctan(105 ÷ 140) = 36.87°
  • Handrail: 175 + 6 + 6 = 187 in (15.58 ft). Buy a 16 ft length
  • Baluster pitch: 1.25 + 3.5 = 4.75 in; count = ceil(175 ÷ 4.75) = 37 balusters
  • Actual gap: 175 ÷ 37 − 1.25 = 3.48 in, under the 4 in limit, code-safe
  • Newel posts: ceil(15.58 ÷ 6) = 3 (top, bottom, one intermediate)
  • Cost: handrail 15.58 × $12 = $187; balusters 37 × $8 = $296; newels 3 × $85 = $255; bottom rail 15.58 × $6 = $94; total about $832
  • Risers: 105 ÷ 7.5 = 14 risers at 7½ in each

2. The same stair railed on both sides

  • Handrail: 2 × 15.58 = 31.17 ft. Buy two 16 ft lengths
  • Balusters: 2 × 37 = 74, at the same 3.48 in gap
  • Newel posts: 2 × 3 = 6
  • Cost: handrail $374, balusters $592, newels $510, bottom rail $187. Total about $1,663
  • Two sides cost exactly double the materials, but the labour is less than double. The second side reuses the same measurements and cuts

3. Metal balusters: 96 in rise, 120 in run, one side

  • Slope length: √(96² + 120²) = √23,616 = 153.67 in (12.81 ft)
  • Stair angle: arctan(96 ÷ 120) = 38.66°
  • Handrail: 153.67 + 12 = 165.67 in (13.81 ft). Buy a 14 ft length
  • Balusters: ceil(153.67 ÷ 4.75) = 33, actual gap 153.67 ÷ 33 − 1.25 = 3.41 in
  • Newel posts: ceil(13.81 ÷ 6) = 3
  • Cost (metal): handrail 13.81 × $14 = $193; balusters 33 × $12 = $396; newels 3 × $110 = $330; total about $919. No bottom rail, so the total is lower than it looks despite the dearer balusters

Baluster spacing: the 4-inch sphere rule

The code rule is simple to state and easy to get wrong: no opening in a guard or stair rail may pass a 4 in sphere (IRC R312). That is a test about the CLEAR gap between balusters, not the centre-to-centre distance. With 1¼ in balusters, a 4 in clear gap means a 5¼ in pitch; with ½ in iron balusters, it means a 4½ in pitch. Count balusters by the pitch and the gap takes care of itself, but count by the gap alone and you will be one baluster short.

Baluster widthMax clear gapMax pitch (centre to centre)Balusters per 10 ft of slopeActual gap at that count
½ in (iron)3½ in4 in303.50 in
1 in (wood)3½ in4½ in273.44 in
1¼ in (wood)3½ in4¾ in263.37 in
1½ in (wood)3½ in5 in243.50 in
2 in (square wood)3½ in5½ in223.45 in
1¼ in (wood)4 in (code max)5¼ in233.98 in

Counts are per 10 ft (120 in) of slope, rounded up. The last row shows the code maximum with no margin. A baluster a fraction out of place puts the gap over 4 in, which is why the calculator defaults to 3½ in.

The safe habit is to work with a 3½ in maximum gap and let the calculator recompute the actual gap, 3.48 in on the default stair, 3.41 in on the metal example. The actual gap is always a little under the maximum, because the count is rounded up. That margin absorbs balusters that are slightly out of square, a newel that sits a fraction off, and an inspector with a 4 in ball in his pocket.

For the stair itself, risers, treads and stringer length, use the stair calculator, which works out the rise and run this page needs.

Handrail length: follow the slope, not the run

The commonest handrail mistake is measuring the horizontal run and buying that much rail. The handrail follows the slope, and the slope is always longer than the run, by about 25% on a typical stair. The default stair runs 140 in horizontally but its slope is 175 in, and the handrail is 187 in with the overhangs. Buying 140 in of rail would leave you 47 in short, which is a second trip to the yard and a joint in the middle of the rail.

Total riseTotal runSlope lengthHandrail (+12 in overhang)Stock length to buy
84 in (12 risers)110 in138.00 in (11.50 ft)150.00 in (12.50 ft)14 ft
96 in120 in153.67 in (12.81 ft)165.67 in (13.81 ft)14 ft
105 in (14 risers)140 in175.00 in (14.58 ft)187.00 in (15.58 ft)16 ft
112 in (15 risers)150 in187.00 in (15.58 ft)199.00 in (16.58 ft)18 ft
120 in (16 risers)160 in200.00 in (16.67 ft)212.00 in (17.67 ft)18 ft

Slope = √(rise² + run²). Stock lengths are the next standard length above the handrail need. Handrails are sold in 8, 10, 12, 14, 16 and 18 ft lengths.

The overhang is the other half of the length: 6 in past the top riser and 6 in past the bottom riser, so the hand is on the rail before the first step and after the last one. Some codes and some inspectors want the rail to return to the wall or the newel rather than ending in open air, a volute or a gooseneck at the bottom and a return at the top, and those fittings add length and cost that a straight rail does not have. If your rail ends in a fitting, measure to the fitting, not to the newel.

Wood, metal or cable: cost and look

Three materials dominate stair rails, and they differ more in labour than in materials. Wood is the cheapest and the most forgiving: a wood handrail at about $12 per foot, wood balusters at about $8 each, and newel posts at about $85. Metal, usually iron balusters with a wood handrail, costs more per baluster (about $12 each) but the same per foot of rail, and it reads as lighter and more open. Cable rail is the dearest per foot (about $22) but needs no balusters at all, which is why its total can surprise people: the fittings and the tensioning hardware are where the money goes.

MaterialHandrail per ftBaluster eachNewel eachDefault stair total (1 side)Look
Wood$12$8$85About $832Warm, traditional, forgiving to fit
Metal (iron balusters)$14$12$110About $919Lighter, more open, modern-traditional
Cable rail$22n/a (no balusters)$140About $763Minimal, open view, most light

Totals are materials only, for the default stair (15.58 ft handrail, 37 balusters, 3 newels) except cable, which is priced for the same stair without balusters: 15.58 × $22 = $343 of rail plus 3 × $140 of newels. Installation typically doubles the materials cost.

Cable rail has a code catch worth knowing: the cables must be tensioned so a 4 in sphere cannot pass between them, and cables stretch, which means the rail needs re-tensioning over time, and some inspectors test it with a spreader. Wood and metal balusters do not move. If the view matters more than the maintenance, cable wins; if the rail must pass inspection once and never be touched again, wood or metal wins.

Newel posts: where they go and why

Newel posts are the anchors of the whole rail: the handrail ends in them, the balusters hang from the rail between them, and they take the load when someone grabs the rail. The minimum is two, one at the bottom of the flight and one at the top, and a long flight needs one about every 6 ft so the rail does not flex. The default stair, at 15.58 ft of handrail, needs three: bottom, top, and one in the middle.

Handrail lengthNewel postsWhere they go
Up to 6 ft2Bottom and top only
6–12 ft2–3Bottom, top, one intermediate if over about 10 ft
12–18 ft (default 15.58 ft)3Bottom, top, one intermediate
18–24 ft4Bottom, top, two intermediates
With a landing+1 per landingA newel at every turn and landing
With a 90° turn+1A newel at the turn, even on a short flight

A newel at a turn is structural, not decorative. The rail changes direction there and the post takes the load. Never span a turn without one.

Setting a newel is the part of the job that most often goes wrong, because the post must be solid: bolted through the stringer or the floor framing, not just screwed to the tread. A newel that wobbles will loosen the whole rail, and a rail that moves will fail inspection. The rule is to bolt the newel to structure; a lag bolt through the stringer, or a mounting plate bolted to the floor joist, and to check it by pulling hard before the balusters go in.

Code checklist: handrails and guards (IRC R311.7, R312)

The code gives stair rails a short checklist, and it is worth running through it before ordering materials. Handrails are required on at least one side of any stairway with four or more risers, at 34 to 38 in above the nosing line, with a grip size of 1¼ to 2 in (or an equivalent graspable shape) and returns at the ends. Guards are required on any open side where the drop is more than 30 in, at least 36 in high, with no opening that passes a 4 in sphere. Risers are at most 7¾ in and treads at least 10 in, with no more than ⅜ in of variation between risers in a flight.

RuleCodeRequirementDefault stair
Handrail requiredIRC R311.7.84+ risers, at least one side14 risers | required
Handrail heightIRC R311.7.834–38 in from nosing lineSet at 36 in
Guard requiredIRC R312.1Drop over 30 in105 in rise | required
Guard heightIRC R312.1At least 36 in36 in on landings
Baluster gapIRC R312No 4 in sphere passes3.48 in actual. Passes
Max riserIRC R311.7.5.17¾ in7½ in. Passes
Min treadIRC R311.7.5.210 in10 in. Passes

Residential code (IRC). Commercial stairs follow the IBC and OSHA, which are stricter. 42 in guards and different handrail rules. Always check your local amendments.

The variation rule is the one that surprises people: the tallest and shortest risers in a flight may differ by no more than ⅜ in. A stair that starts with a 7 in riser because the floor went in late and ends with an 8 in riser because the top landing is thick will trip people even if every riser is individually legal. Measure the total rise, divide by the riser count, and cut every riser the same.

Common stair railing mistakes

  • •Buying the run length instead of the slope length. The default stair needs 187 in of rail, not 140 in, a 47 in shortfall.
  • •Counting balusters by the gap instead of the pitch. The pitch is baluster width plus gap; counting by the gap alone leaves you one baluster short and the gap over 4 in.
  • •Rounding the baluster count down. Rounding down is the only direction that breaks the code, always round up.
  • •Setting the handrail height from the tread instead of the nosing line. The 34–38 in is measured from the sloped line of the nosings, not from a single tread.
  • •Screwing the newel to the tread. A newel must be bolted to the stringer or the floor framing, a screwed newel wobbles and loosens the whole rail.
  • •Forgetting the landing newel. Every turn and landing gets a newel, even on a short flight. The rail changes direction there.
  • •Using cable rail without checking tension. Cables stretch, and a slack cable passes a 4 in sphere, budget for re-tensioning.
  • •Mixing baluster sizes in one run. Different widths change the pitch, and the gap stops being even. Buy one size for the whole flight.

How this calculator compares with the rivals

The stair-railing search is thin: most rivals are stair calculators with a railing section, not railing calculators. The gap is a dedicated railing tool that counts balusters to the code, prices the materials, and explains the newel posts, instead of burying the rail in a stringer calculation.

RivalWhat it offersWhere this page beats it
BuildItCalc | Stair Railing CalculatorHandrail length, balusters and posts for a stair run, the named rivalThis page adds the actual gap recomputed after rounding, the cost breakdown by material, and the newel-post spacing rule it does not show.
Calculator City | Stair Railing CalculatorHandrail length, balusters and posts with the 4 in sphere ruleGood on the code. This page adds the cost by material, the stock-length guidance and the worked two-sided example.
Deck Stair CalculatorStringers, railing code and equal baluster spacing with miter anglesThe strongest rival on equal spacing. This page adds the cost, the newel rule and the wood/metal/cable comparison.
FreeConstructionTools | Stair CalculatorRisers, treads, stringers, headroom and a handrail/baluster sectionGood whole-stair tool. This page is the dedicated railing calculator, with the cost and the code checklist the stair tool does not have.
Calculator City | Handrail CalculationsHandrail length and baluster count from rise and runGood handrail math. This page adds the newel posts, the cost and the material comparison.
LogicCommons | Deck Material TakeoffFull deck takeoff including rail runs, posts and balustersThe deepest rival on takeoffs. This page is the quick single-stair check with pricing, not a whole-deck drawing.
Omni Calculator | Stair CalculatorStair geometry with a railing section in its construction setGood stair geometry. This page is the dedicated railing tool with cost and the 4 in sphere check.
BuildCova's own stair calculatorRisers, treads, stringer length and headroom for the stair itselfThe sibling page, not a rival. The stair calculator gives the rise and run; this page rails the stair it describes.
BuildCova's own deck railing calculatorRailing for a level deck, posts, balusters and rail by the footThe sibling page for flat runs. Stair rails follow a slope, so the math is different. This page does the slope.

The honest summary: Deck Stair Calculator is the rival to watch, because it already does equal baluster spacing with the code behind it. No rival combines the slope-following handrail length, the code-checked baluster count with the actual gap, the newel-post rule and a materials cost by wood, metal and cable in one place. This page wins by being the dedicated railing tool, not a section of a stair tool.

Assumptions

  • •The code rule is the 4-inch sphere test (IRC R312): no opening in the railing may pass a 4 in sphere. This calculator sizes the baluster count so the CLEAR gap between balusters stays under 4 in, with a 3½ in maximum as the default for margin.
  • •Handrail height is 34 to 38 in, measured vertically from the sloped plane of the stair nosings (IRC R311.7.8). Handrails are required on stairways with four or more risers.
  • •Guards are required when the total rise is more than 30 in above the floor below (IRC R312.1), and guard height is at least 36 in on a landing.
  • •Newel posts: one at the top, one at the bottom, plus one about every 6 ft of handrail. Long runs and turns need more. A landing or a 90° turn always gets a newel.
  • •Handrail length includes 6 in of overhang at each end by default. The grip extension past the top and bottom risers. Set it to 0 for a rail that stops at the newels.
  • •Prices are US planning ranges for 2026: wood handrail about $12 per foot, metal balusters about $12 each, newel posts $85–$140 each. Cable rail costs more per foot but needs no balusters.

Sources✓ Verified

  • International Residential Code (IRC) R311.7. Stairways: handrails required on 4+ risers, handrail height 34–38 in from the nosing line, maximum riser 7¾ in, minimum tread 10 in.
  • International Residential Code (IRC) R312. Guards: required above 30 in, minimum 36 in high, openings must not pass a 4 in sphere.
  • Stairway Manufacturers' Association (SMA) balustrade guidance. Baluster spacing practice and the 4 in sphere test as applied to stair rails.

Formula reviewed November 2026.

Divide the slope length of the stair by the baluster pitch, baluster width plus the maximum clear gap, and round up. The default stair here has a 175 in slope, 1¼ in balusters and a 3½ in maximum gap, so it needs 37 balusters per side at an actual gap of 3.48 in. Two sides need 74. Always round up: rounding down leaves a gap over the 4 in code limit.

The clear gap between balusters must be less than 4 in, so a 4 in sphere cannot pass through (IRC R312). With 1¼ in balusters, that means a pitch of at most 5¼ in centre to centre. This calculator defaults to a 3½ in maximum clear gap, which gives margin for balusters that are not perfectly straight and keeps the actual gap at 3.48 in on the default stair.

The handrail follows the slope: handrail length = √(rise² + run²) + the overhang at each end. The default stair; 105 in of rise, 140 in of run, has a 175 in slope (14.58 ft), and with 6 in of overhang at each end the handrail is 187 in (15.58 ft). Buy the next stock length up: a 16 ft handrail for a 15.58 ft need.

34 to 38 in, measured vertically from the sloped plane connecting the stair nosings to the top of the handrail gripping surface (IRC R311.7.8). Handrails are required on at least one side of any stairway with four or more risers. Guards on landings and open sides must be at least 36 in high (IRC R312.1).

The default stair, one side, wood, 15.58 ft of handrail, 37 balusters and 3 newel posts, costs about $832 in materials: $187 of handrail, $296 of balusters, $255 of newels and $94 of bottom rail. Two sides cost about $1,663. Metal balusters add about $4 per baluster, cable rail costs about $22 per foot of handrail but needs no balusters. Installation typically doubles the materials cost.

At least two, one at the bottom and one at the top, plus one about every 6 ft of handrail on a long run. The default 15.58 ft handrail needs 3 newel posts. A landing, a 90° turn or a 180° turn always gets a newel at the turn, and a very long straight run needs intermediate newels so the handrail does not flex.

Converters to use with the Stair Railing Calculator

Switch units, compare bulk and bagged quantities, or check coverage, without leaving BuildCova.

Browse all converters

More framing calculators

Egress Window CalculatorFramingEgress Window CalculatorAn egress window calculator that checks a bedroom or basement window against the building code before you cut the wall or order the window. Enter the clear opening width and height, the sill height and the room type, and see whether the opening passes all four IRC R310 rules, net clear area, minimum width, minimum height and maximum sill height, plus the window well rules for a below-grade window, and the window size that would pass.Right Angle CalculatorFramingRight Angle CalculatorA right angle calculator that squares corners before a fraction of a degree puts the far end of a 40 ft wall inches off the footing. Enter any two sides of a right triangle to solve the third and both angles, check a corner you have already marked by entering the diagonal you actually measured, or scale the 3-4-5 rule to any size and find a neat multiple that fits your job.Wall Framing CalculatorFramingWall Framing CalculatorA wall framing calculator that works out the full lumber list for a framed wall, not just a stud count. Enter the wall length and height, the stud spacing and the windows and doors, and the calculator gives you every piece: the field studs, the king and jack studs at each opening, the corner studs, the double top plate and bottom plate, the headers, the cripple studs and the sheathing sheets. It is the list you take to the lumber yard.Fastener Spacing CalculatorFramingFastener Spacing CalculatorA fastener spacing calculator that gives you the maximum spacing the code allows, the edge distance the fastener must keep, and the fastener count for the run. A deck board fastened with screws goes 16 in on centre, and a 12 ft run needs 10 screws, one at each joist crossing plus one at the start. A fastener that is too far apart holds nothing, and a fastener that is too close to the edge splits the wood, so check it before you drive the first one.Stair CalculatorFramingStair CalculatorA stair calculator that turns your total rise, floor to floor or ground to deck, into the riser count, tread count, actual riser height and total horizontal run. It works for deck stairs, porch steps, basement stairs and full flights. Uneven risers trip people; a wrong run lands the last step past the landing, so get both numbers before you cut a stringer.Lumber Board Feet CalculatorFramingLumber Board Feet CalculatorThis board feet calculator converts your lumber's nominal dimensions and quantity into total board feet, the standard unit lumber is priced and sold by, so you can check a quote and estimate the cost before you buy. Enter the thickness, width, length and number of boards. Ten 2 by 6 boards, 8 ft long, are 8 board feet each, or 80 board feet in total.

Material requirements can vary based on product specifications and job conditions. Verify quantities with your supplier before ordering.