Railing Picket Spacing Calculator: Code & Formula
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This calculator works out the exact spacing between railing pickets (balusters) so the gaps meet typical building code requirements. You enter the total railing length, the picket width, and the number of pickets (or the maximum allowed gap), and it returns the precise on-center spacing and the clear gap between pickets. The result is given in inches and can be converted to feet and inches for layout.
Formula
The on-center spacing (distance from the center of one picket to the center of the next) is calculated as:
On-center spacing = (Total length in inches – Picket width × Number of pickets) / (Number of pickets + 1) + Picket width
Where:
- Total length (L) – the horizontal distance between the posts or end supports, in feet (converted to inches by multiplying by 12).
- Picket width (pw) – the actual width of one picket, in inches.
- Number of pickets (n) – how many pickets you plan to install.
The clear gap (the open space between two pickets) is simply the numerator without adding the picket width:
Clear gap = (Total length in inches – Picket width × Number of pickets) / (Number of pickets + 1)
This formula assumes pickets are evenly spaced and that the first and last pickets are placed at the very ends of the railing (no extra end gap). If you need a margin at each end, adjust the total length accordingly.
Worked Example
Using the default values: railing length = 8 ft, picket width = 1.5 in, number of pickets = 13.
- Convert length to inches: 8 ft × 12 = 96 in.
- Total width of all pickets: 13 × 1.5 = 19.5 in.
- Space left for gaps: 96 – 19.5 = 76.5 in.
- Number of gaps = pickets + 1 = 14.
- Clear gap = 76.5 / 14 = 5.464285… ≈ 5.46 in.
- On-center spacing = 5.46 + 1.5 = 6.96 in.
The calculator shows on-center ≈ 6.96 in, clear gap ≈ 5.46 in, and total length used = 1.5×13 + 12×5.46 = 19.5 + 65.52 = 85.02 in, which is less than 96 in because the gaps are rounded. In practice, you would adjust the number of pickets to get a gap that meets your local code (often ≤ 4 inches).
Why Picket Spacing Matters
Picket spacing isn’t just about looks—it’s a safety issue, especially for decks, balconies, and stairs. Most residential building codes in the U.S. require that the space between balusters be no more than 4 inches. This is to prevent small children from getting their heads or bodies stuck. Some jurisdictions have even stricter rules for commercial buildings or for railings near pools. Always check your local code before finalizing the layout.
The 4-inch rule comes from the fact that a typical child’s head is about 5 inches in diameter, but a 4-inch gap is considered safe because it prevents a child from squeezing through. Even if you don’t have children, following the code ensures your railing passes inspection and is safe for anyone who might use it.
How to Use the Calculator
To get a code-compliant layout, you usually start with the maximum allowed gap (e.g., 4 inches) and solve for the number of pickets. Here’s a step-by-step approach:
- Measure the total length of the railing between posts (in feet).
- Measure the actual width of one picket (in inches).
- Decide on the maximum gap you want (typically 4 in).
- Use the formula to find the number of pickets: n = (Total length in inches + Gap) / (Picket width + Gap) – round up to the nearest whole number.
- Enter that number into the calculator to get the exact on-center spacing and clear gap.
For example, with an 8-ft railing and 1.5-in pickets, the ideal number for a 4-in gap is (96 + 4) / (1.5 + 4) = 100 / 5.5 = 18.18, so you’d use 19 pickets. The calculator with n=19 gives a clear gap of (96 – 28.5) / 20 = 3.375 in, which is safely under 4 in.
Common Mistakes and How to Avoid Them
- Forgetting to convert feet to inches – Always multiply the length in feet by 12 before doing any calculation.
- Using the wrong picket width – Measure the actual picket, not the nominal size. A 2×2 may be 1.5 in wide after planing.
- Not accounting for end posts – If you want a gap between the post and the first picket, subtract that from the total length first.
- Rounding too early – Round only at the final step to avoid cumulative errors.
- Ignoring local code variations – Some areas require 3-inch gaps for certain railings. Always verify.
Alternatives to Even Spacing
If you have a railing with an odd length or you want to avoid cutting pickets, you can adjust the spacing slightly at one end. For example, you might space pickets evenly but leave a slightly larger gap at the post. This is common when the total length doesn’t divide evenly. However, building codes usually require that the gap be uniform and within the maximum, so it’s safer to adjust the number of pickets rather than make one gap larger.
Another option is to use a “gauge block” or a pre-made spacing tool that helps you keep the gap consistent. These are inexpensive and available at hardware stores. They work by placing the block between pickets as you install them, ensuring each gap is the same.
Frequently Asked Questions
What is the maximum gap for railing pickets?
Most residential building codes in the U.S. require a maximum clear gap of 4 inches between balusters. Some jurisdictions may require 3 inches for certain applications, such as railings on stairs or in commercial buildings. Always check your local code.
How do I calculate the number of pickets needed?
Use the formula: n = (Total length in inches + Gap) / (Picket width + Gap). Round up to the nearest whole number. For example, for an 8-ft railing with 1.5-in pickets and a 4-in gap, n = (96 + 4) / (1.5 + 4) = 18.18, so you need 19 pickets.
What is on-center spacing?
On-center spacing is the distance from the center of one picket to the center of the next. It equals the clear gap plus the picket width. This is the measurement you use when marking the layout on the top rail.
Can I use this calculator for stair railings?
Yes, but you must measure the length along the slope of the stair stringer, not the horizontal run. The formula is the same, but the total length is the diagonal distance between posts. Also, check if your local code has different gap requirements for stairs.
What if my railing has a corner or angle?
Measure each straight section separately and calculate the spacing for each section independently. At corners, you may need to adjust the number of pickets so that the gap at the corner is not too large. Some installers add a special corner post or use a wider picket at the turn.
Do I need to consider the picket material?
The material affects the width and durability, but not the spacing formula. However, if you’re using wood, remember that it can shrink or warp, so you might want a slightly larger gap to avoid binding. For metal or vinyl, the width is consistent.
Related
Formula used
in L | Total railing length | ft | 8 | 0 in pw | Picket width | in | 1.5 | 0 in n | Number of pickets | - | 13 | 0 out oc | On-center spacing | in | (L * 12 - pw * n) / (n + 1) + pw | 2 out gap | Clear gap between pickets | in | (L * 12 - pw * n) / (n + 1) | 2 out total | Total length used | in | pw * n + (n - 1) * gap | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.