Spacing Calculator

How we build and test

Enter a length, the number of items to fit along it and the width of each one to get the equal gap between them, the on-center spacing and the position of every item measured from one end. Use it for balusters, pickets, hooks, shelves, slats, pulls and holes.

in

The clear distance to fill, such as post to post or wall to wall.

items
in

Enter 0 to space points or centerlines, such as hooks or holes.

Gap between items

Enter the total length, the number of items and their width.

What this calculator does

  • Equal gap between any number of items along a length
  • On-center spacing with spaces or items at the ends
  • The left edge and center of every item, ready to mark out

How to use the spacing calculator

  1. Measure the clear length to fill in inches: between two posts, two walls or the ends of a board.
  2. Enter the number of items and the actual width of one item. For hooks, screws or holes, enter a width of 0 to space the center points.
  3. Choose the end condition. Pick equal spaces at both ends for balusters between posts or pictures on a wall. Pick an item at each end for slats, shelf brackets or fence pickets that start and finish flush.
  4. Hook your tape on one end and mark every position from that same end.

Formulas

Equal spaces at both ends: gap = (length − items × width) ÷ (items + 1)
An item at each end: gap = (length − items × width) ÷ (items − 1)
On-center spacing = width + gap
Left edge of item k = first edge + (k − 1) × (width + gap)
First edge = gap (spaces at the ends) or 0 (an item at each end)
Center of item k = left edge + width ÷ 2

The only difference between the two end conditions is the number of gaps: one more than the number of items when there is a space at each end, and one fewer when an item sits at each end. Every position is worked out from the exact gap and then rounded to the nearest 1/16 in. That is why you should measure each mark from the same end. Stepping off the rounded gap again and again lets the rounding error build up.

Worked example: five 1 1/2 in balusters in a 96 in opening

  1. Wood: 5 × 1.5 = 7.5 in, leaving 96 − 7.5 = 88.5 in of open space.
  2. Gaps: with a space at both ends there are 5 + 1 = 6 gaps, so 88.5 ÷ 6 = 14.75, or 14 3/4 in.
  3. On-center spacing: 1.5 + 14.75 = 16 1/4 in.
  4. Left edges from one end: 14 3/4, 31, 47 1/4, 63 1/2 and 79 3/4 in.
  5. Centers: 15 1/2, 31 3/4, 48, 64 1/4 and 80 1/2 in.
  6. Check: 5 × 1.5 + 6 × 14.75 = 96 in.

With an item at each end instead, the same five pieces have 4 gaps: 88.5 ÷ 4 = 22 1/8 in, on centers of 23 5/8 in, with left edges at 0, 23 5/8, 47 1/4, 70 7/8 and 94 1/2 in.

Gaps for a 96 in run of 1 1/2 in items

Items Gap, spaces at both ends Gap, item at each end
5 14 3/4 in 22 1/8 in
10 7 3/8 in (7.364) 9 in
15 4 5/8 in (4.594) 5 1/4 in
20 3 1/8 in (3.143) 3 1/2 in (3.474)

Fractions are rounded to the nearest 1/16 in, with the exact decimal in brackets where they differ.

Finding the number of items for a maximum gap

Often the gap is limited and the count is the unknown. Guard balusters are the common case: section R312.1.3 of the International Residential Code does not allow a required guard to have an opening that a 4 in sphere can pass through, so the clear gap must stay under 4 in. Guards on the open side of a stair are allowed slightly more, a 4 3/8 in sphere. To find the count, divide the length less the maximum gap by the item width plus the maximum gap, and round up. For a 72 in opening and 1 1/2 in balusters, (72 − 4) ÷ (1.5 + 4) = 12.4, so 13 balusters, which gives a gap of (72 − 19.5) ÷ 14 = 3 3/4 in. Twelve would leave 4.15 in, which fails. Check your local code for the exact guard requirements.

Questions

How do I calculate equal spacing between objects?

Subtract the combined width of the objects from the total length, then divide by the number of gaps. With a space at each end there is one more gap than objects. Five 1 1/2 in pieces in 96 in gives (96 − 7.5) ÷ 6 = 14 3/4 in.

How far apart should balusters be?

Close enough that a 4 in sphere cannot pass between them, the limit in IRC section R312.1.3, which in practice means a clear gap under 4 in. On-center spacing is that gap plus the baluster width.

How do I space hooks or pictures evenly on a wall?

Enter the wall length, the number of hooks and a width of 0 for hooks, or the frame width for pictures, and choose equal spaces at both ends. Four hooks on a 60 in board sit at 12, 24, 36 and 48 in.

Sources

  1. 2021 International Residential Code, Chapter 3 Building Planning, Section R312.1.3 Opening limitations, International Code Council.
    Used for: required guards not having openings that allow passage of a sphere 4 in in diameter, with 4 3/8 in allowed for guards on the open side of stairs and 6 in at the triangle formed by the riser, tread and bottom rail.

Related calculators