Deck Railing Calculator

Calculate posts, rails, balusters and post caps for any deck railing - to IRC 4-inch sphere code.

The deck railing calculator returns posts, rails, balusters and hardware for any deck railing to IRC code. The driving constraint is the 4-inch sphere rule: balusters must be spaced so that a 4-inch sphere cannot pass through the gap between them. With 3/4 inch square balusters, that means 4.75 in on-center maximum; with 1.25 in balusters, 5.25 in OC. Standard post spacing is 6 ft - max 8 ft by IRC. The 36 inch minimum railing height applies to residential decks; commercial and decks over 30 inches off the ground need 42 inch railings. Add one extra post per gate for the latch side.

Explore all our decking calculator tools, or browse the full construction & home improvement diy calculators.

Frequently asked questions

At 4.5 inch on-center spacing (the most common to clear the 4 inch sphere code with 3/4 in balusters): 12 / 4.5 = 2.67 balusters per foot. A 44 ft railing perimeter = 117 balusters. At 5 inch OC (with 1.25 inch balusters): 105 balusters. Always round up - the last bay on each section usually needs a smaller gap to make the math work out at the post.

IRC code R312.1 requires that a 4-inch sphere cannot pass through any gap in a guardrail. This applies to baluster spacing, the gap below the bottom rail (max 4 inches above the deck surface) and any other opening in the railing system. The rule prevents small children from getting their heads stuck. For balusters: maximum clear gap is 3.99 inches - so baluster on-center spacing equals 3.99 + baluster width.

36 inches minimum from the deck surface to the top of the railing for residential decks 30 inches or less above the ground. 42 inches for decks more than 30 inches above grade. Commercial decks always require 42 inches. The top rail itself is typically a 2x6 cap; the structural top rail (the 2x4 or 2x6 the balusters attach to) is 2-3 inches below the cap.

6 ft is the most common post spacing for residential decks - matches standard 8 ft 2x4 top rail lengths with overhang. 5 ft for steeper or taller decks; 4 ft for glass-panel railings or any high-load railing. Maximum 8 ft by IRC. Closer spacing makes the railing stiffer and reduces flex when someone leans on it.

Standard 2x2 (1.5 inch actual) balusters work for IRC code as long as spacing keeps the clear gap under 4 inches - 5.25 inch on-center with 1.5 inch balusters. Specialty balusters (square aluminum, twisted iron, cable, glass panels) all need their own engineering. Cable rail systems are popular for unobstructed views but require very stiff posts (6x6 minimum) because cable tension pulls posts inward.

Related tools