Skip to main content
ponderloop

Deck Railing Calculator: Posts, Rails and Balusters

A wood deck guard 36 in high along a 20 ft side with a 3 ft stair opening and a 12 ft side, joined at a corner and with posts no more than 6 ft apart, needs 7 rail boards (2 × 4 × 12 ft, with 5% extra), 8 posts, 12 rail pieces and 59 balusters (2 × 2, gaps under 4 in, with 5% extra) for 29 ft of railing. Posts are the stretches split into equal bays no longer than 6 ft, plus one; each bay takes a top and a bottom rail.

Figures based on the sources listed belowUpdated How we calculate

Extra rail boards and balusters (your choice)

The next side of the deck that gets a guard. Leave 0 if there is none.

A third side, or 0.

A fourth side, or 0.
Runs are counted in order: 1, then 2, 3 and 4. A corner needs one post, so joined runs share it. Measure each run post centre to post centre.

Gaps in the guard, taken from run 1 and counted as in the middle of it: a post each side and the rest split into equal stretches. For an opening on another side, enter that side as run 1. An opening at the very end of a run needs one fewer post.

A stair or a gate; the stair width and gate size are yours to measure. 36 in is a common stair width.
A maximum: each stretch is split into equal bays no longer than this. 6 ft is the typical figure for wood 4 × 4 guard posts in connector makers’ instructions, not a number in the IRC: the IRC asks the guard to resist a 200 lb load and leaves the design to the builder.
The 2 × 4 length you will buy. Rail pieces are cut from it so that as few boards as possible are used.
The width across the face, seen from the front.

A maximum, so the equal gap worked out is always under it. The IRC says a 4 in sphere must not pass (R312.1.3); on the open side of stairs it is 4 3/8 in. Your local code governs.

From the deck surface to the underside of the bottom rail. It must also stop a 4 in sphere, so keep it under 4 in. It sets the baluster length.

Buy 7 rail boards.

Buy 7 rail boards

29 linear ft + 5% waste = 30.45 linear ft

  • Posts (4 × 4): 8 posts (each at least 3 ft), at most 6 ft apart, a post at every corner and end
  • Rails (2 × 4: top and bottom): 12 pieces, 6 bays × 2
  • Rail boards (2 × 4 × 12 ft): 7 boards, 6 for the cut list, plus waste
  • Balusters: 59 balusters, 56 in the bays, plus waste
  • Baluster layout: 8 per 51 in bay (4 bays), gap 3.94 in; 12 per 72 in bay (2 bays), gap 3.88 in
  • Baluster length: 30 in between the rails, plus any tenon or mounting allowance
  • Railing: 29 ft, after openings, post centre to post centre
  • Cut list (first-fit, inches): 2 × 72 in + 72 in; 4 × 51 in + 51 in (before waste)
  • Guard height: 36 in, at or over the 36 in residential minimum (IRC R312.1.2)
  • Gap under the bottom rail: 3 in under the bottom rail
  • Largest baluster gap used: under 4 in; the open side of a stair is held to 4 3/8 in
How this number is calculated

29 linear ft + 5% waste = 30.45 linear ft ÷ 4.35 linear ft per rail board = 7 rail boards

Shopping list

  • 4 × 4 deck posts, pressure treated
  • 2 × 2 deck balusters (36 in)
  • Deck post caps
  • Exterior structural screws
  • Baluster spacing jig
  • Tape measure with 1/16 in marks
Show diagram

Saved projects

No saved projects yet.

Posts for one straight run by post spacing

Posts for a single straight run with no opening: the fewest equal bays no longer than the spacing, plus one. Worked by this calculator. A corner or an opening adds a post.
RunPosts at 6 ftPosts at 5 ftPosts at 4 ft
6 ft233
8 ft333
10 ft334
12 ft344
16 ft455
20 ft556
24 ft567
30 ft679

Balusters in one bay by bay length

Post centre to post centre, 4 × 4 posts, gap under 4 in, worked by this calculator with the baluster spacing method. Multiply by the number of bays; 2 × 2 balusters are 1.5 in wide, metal bars 3/4 in.
Bay2 × 2 balustersGap3/4 in metalGap
3 ft63.36 in73.41 in
4 ft83.61 in93.78 in
5 ft103.77 in123.65 in
6 ft123.88 in143.87 in

Rail boards for one straight run by board length

A top and a bottom 2 × 4 rail in every bay of up to 6 ft, packed first-fit, no extra percentage, worked by this calculator.
Run8 ft boards10 ft boards12 ft boards16 ft boards
6 ft2211
8 ft2221
10 ft4222
12 ft4422
16 ft6632
20 ft8443
24 ft8844
30 ft101055

Methodology & assumptions

Each run is the length of guard along one side of the deck, measured post centre to post centre. Openings for stairs or a gate come out of run 1: with the 20 ft run and one 3 ft opening, 17 ft are left, split into two stretches of 8.5 ft, one each side of the opening, with a post at each end of every stretch. (An opening at the very end of a run saves a post; enter such a side as a run with no opening.) Each stretch is divided into the fewest equal bays that are no longer than the post spacing: 8.5 ft over 6 ft is 2 bays of 51 in. Posts are bays + 1 per stretch, and runs joined at a corner share the corner post. The 6 ft spacing is a typical figure for wood 4 × 4 posts, taken from connector and deck-guide practice, not a number in the model code: the IRC (Table R301.5) asks a guard to resist a 200 lb concentrated load at the top, and what post size, spacing and connection achieve that is a design question, so check your jurisdiction’s deck handout or the AWC prescriptive deck guide (DCA 6) and use closer posts if it says so. Rails: every bay has a top and a bottom rail, cut to the bay length, and the pieces are packed onto stock boards by the first-fit decreasing method (longest piece first, each into the first board with room). The cut list is shown in inches, and each board’s pieces are joined with a plus sign. Saw kerf, a rail that continues over a post, and a rail cap are not modeled; the waste percentage pays for kerf and culls. Balusters: in each bay the clear span is the bay length less a 3.5 in post, and the baluster spacing calculator’s equal-gap method gives the fewest balusters whose gap stays under the largest gap allowed: n balusters of width w leave n + 1 equal gaps of (span − n × w) ÷ (n + 1), and n is the smallest whole number that makes that gap less than 4 in. The IRC requires that a 4 in sphere cannot pass through any opening of the guard (R312.1.3), including the space under the bottom rail; the guard must be at least 36 in high for a residential deck (R312.1.2). The baluster length is the guard height less the gap under the bottom rail and two 1.5 in rails (estimate for 2 × 4 rails laid flat). Posts are not increased by waste; rail boards and balusters carry the extra percentage you pick. Hardware (post brackets, hold-downs, screws and connectors) is not counted: the numbers depend on the connector and the framing and the maker’s instructions, so they come from the product you buy. Local code governs; some jurisdictions need a permit, a particular post connection or guards at lower heights. The metric toggle shows lengths in m and the openings and baluster widths in cm.

How to calculate deck railing

  1. Measure each run. Measure every side that needs a guard from post centre to post centre, up to four, and note any stair or gate openings.
  2. Split into bays. Take the openings out, then divide each stretch into the fewest equal bays no longer than the post spacing, 6 ft at most for typical wood 4 × 4 posts. Posts are bays + 1 per stretch, less one for each corner shared.
  3. Cut the rails. Each bay takes a top and a bottom rail the length of the bay. Pack the pieces onto stock boards, longest first.
  4. Space the balusters. For each bay, take the clear span between the posts and find the fewest balusters that leave every gap under 4 in, then divide the space equally.
  5. Check the code. The guard needs to be at least 36 in high, stop a 4 in sphere, including under the bottom rail, and resist a 200 lb load at the top. Check your local code and the post connection.

Worked examples

ProjectResult
20 ft side with a 3 ft stair opening plus a 12 ft side, joined, 36 in guard, 6 ft posts, 2 × 2 balusters, 12 ft rail boards29 ft of railing → 7 rail boards (12 ft), 8 posts, 12 rail pieces, 59 balusters
The same railing with the corner posts counted for each run (separate runs)29 ft of railing → 7 rail boards (12 ft), 9 posts, 59 balusters
The same railing with 3/4 in square metal balusters29 ft of railing → 7 rail boards (12 ft), 8 posts, 72 balusters
The same railing with posts at 5 ft at most29 ft of railing → 7 rail boards (12 ft), 9 posts, 59 balusters
A straight 24 ft run with no opening24 ft of railing → 5 rail boards (12 ft), 5 posts, 51 balusters
Three sides of 16, 12 and 16 ft, joined, no openings, 10% extra44 ft of railing → 9 rail boards (12 ft), 9 posts, 99 balusters

Frequently asked questions

How far apart should deck railing posts be?
For wood 4 × 4 posts, 6 ft on center is the typical maximum: it is the figure in connector makers’ guard post instructions and in many deck handouts. It is not written into the IRC, which asks the guard as a whole to resist a 200 lb concentrated load at the top (Table R301.5) and leaves the post size, spacing and connection to the design. Closer posts (4 to 5 ft) make a stiffer guard. The calculator treats the spacing as a maximum and splits each stretch into equal bays.
What load must a deck railing resist?
A single concentrated load of 200 lb at the top of the guard, in addition to the loads on the infill (IRC Table R301.5). The 2021 IRC applies the 200 lb to guards in the outward and downward directions; earlier editions say any direction. The post connection to the deck framing is usually the weak point, so follow a tested detail, such as those in the AWC DCA 6 deck guide or the connector maker’s instructions, and ask your building department which one it accepts.
How high must a deck railing be?
At least 36 in above the deck surface for a residential deck under the IRC (R312.1.2). Some jurisdictions require 42 in, and guards on stairs are measured from the line of the tread nosings and can differ. The calculator flags a guard under 36 in, but local code governs.
What is the 4 inch sphere rule?
No opening in the guard may let a 4 in sphere pass (IRC R312.1.3). That covers the space between balusters, between a baluster and a post, and the gap under the bottom rail, so keep that gap under 4 in. On the open side of stair treads the limit is 4 3/8 in. This calculator keeps the gap strictly under the largest gap allowed: in a 51 in bay between 4 × 4 posts it puts 8 2 × 2 balusters with gaps of 3.94 in.
How many balusters do I need?
Work each bay: the clear span between posts is the bay length less the 3.5 in post, and the balusters are the fewest that leave every gap under 4 in. The example above has 6 bays and needs 56 2 × 2 balusters, 59 with 5% spares. With 3/4 in square metal bars the same railing needs 68.
How are the rails cut and counted?
Every bay has a top rail and a bottom rail, each the length of the bay, so the example has 12 pieces. They are packed onto stock boards longest first: with 12 ft boards the cut list is 2 × 72 in + 72 in; 4 × 51 in + 51 in, 6 boards, 7 with 5% extra. The same railing needs 12 boards of 8 ft, so the board length you buy matters. This does not model a rail that runs over a post in one piece or a cap rail.
How do I enter a stair or gate opening?
Put the side with the opening first, enter how many openings and how wide each is, and the calculator takes them out of run 1 and puts a post each side. In the example a 3 ft opening in the 20 ft side leaves 17 ft in two stretches, 8 posts in all. With no opening the same railing is 32 ft and 7 posts. An opening at the end of a run needs one post fewer than the calculator counts.
Do posts at corners count once or twice?
Once. Runs joined end to end share the corner post, so the 20 ft and 12 ft sides of the example have 8 posts rather than 9. Choose Separate runs for guards that do not meet.
Does it count brackets, screws and post caps?
No. Hardware depends on the post connection you use (a hold-down, a bracket or a bolted detail), the framing and the maker’s instructions, and no single count holds for all of them, so the calculator leaves it to the product. Count the connectors from the instructions of the one you buy.

Handy tools

  • Stair Calculator: The guard along the stairs follows the stair’s rise and run: work out the steps first, then the opening you enter above.
  • Feet and Inches Calculator: Add up a side measured in feet, inches and fractions, and get the decimal feet for the length fields above.

Related calculators