Equal spacing calculator for slats, shelves and balusters

Total length, how many pieces and how wide they are: get the gap between them and where to mark each one, in millimeters or inches with fractions.

Slats on a bench, shelves in a bookcase, bars on a crib rail: the same problem every time. Type the space you have, how many pieces go in and their width, and get the gap and a list of marks.

Gap
—
Edge to edge
—

Marks from the left end (near edge of each piece)

PieceMarkOff from exact

Everything is calculated in your browser. Nothing is saved or sent.

How it works

With a gap at both ends, n pieces leave n + 1 gaps, so gap = (total − n × width) / (n + 1). With the first and last piece flush to the ends, there are n − 1 gaps, so gap = (total − n × width) / (n − 1).

Each mark is measured from the same end, to the near edge of each piece: gap + (i − 1) × (width + gap) with gaps at both ends, or (i − 1) × (width + gap) with pieces flush. Measuring every mark from one end keeps small errors from adding up.

In inches, marks are rounded to the nearest 1/16, 1/32 or 1/64. The page shows how far the rounded mark is from the exact one so you can decide whether it matters.

Common questions

Does this follow building codes for railings?

No. It only does the arithmetic. Codes set a maximum gap for balusters, and they vary by place, so check yours.

What if the gap comes out negative?

The pieces do not fit. Use fewer pieces or narrower ones.

One letter a month: what I read, where the sources disagree, and which guides I corrected.

No gifts and no PDFs. Unsubscribe in one click. The form does nothing until an endpoint is configured.