Skip to content

Even Spacing Calculator

Enter a length, the number of elements and the width of each one to get the equal gap between them, with equal gaps at the edges or with the first and last element against the ends. Or enter the gap you want and see how many elements fit. Every left edge, center and right edge is listed to copy.

Equal gap

12 cm

5 equal gaps · equal gaps at both edges and between the elements · 4 × 10 cm in 100 cm

Positions from the start

#Left edgeCenterRight edge
1121722
2343944
3566166
4788388

Edges included: gap = (length − n × width) ÷ (n + 1). Flush ends: gap = (length − n × width) ÷ (n − 1). Use the same unit for every field; the unit label is only written next to the results. Nothing you type leaves your browser.

How it works

  1. Choose “I know how many” or “How many fit”, then choose edges included or flush ends.
  2. Enter the length, the width of one element and either the number of elements or the gap you want. Add a unit label if you like.
  3. Read the equal gap, or the number of elements that fit, and the leftover space.
  4. Use the table of left edges, centers and right edges, or copy the centers, to mark out your layout.

What people use it for

  • Shelves, hooks and pegs on a wall

    Find where to put each hook so the gaps are equal, measured from one end of the wall.

  • Fence boards, slats and posts

    Check how many slats fit between two posts with a gap you choose, and what the gap becomes if you spread them out.

  • Frames, tiles and photos

    Hang a row of pictures with equal gaps and the same margin at both ends.

Questions

How is the gap calculated?
With edges included there are n + 1 equal gaps: gap = (length − n × width) ÷ (n + 1). With the first and last elements against the ends there are n − 1 gaps: gap = (length − n × width) ÷ (n − 1), so at least 2 elements are needed. Five elements of 10 in a length of 100 give (100 − 50) ÷ 6 = 8.33 with edges, and (100 − 50) ÷ 4 = 12.5 without.
How is the number that fit worked out?
With edges included the elements and gaps take n × width + (n + 1) × gap, so n = floor((length − gap) ÷ (width + gap)). Flush ends take n × width + (n − 1) × gap, so n = floor((length + gap) ÷ (width + gap)). The leftover is the length minus that space; spread over the gaps, it makes the gap a little larger than the one you asked for.
How are the positions measured?
From the start of the length. The left edge of the first element is the edge gap with edges included, or 0 with flush ends; each next left edge is the previous one plus the width plus the gap. The center is the left edge plus half the width. Use the same unit everywhere: the page does not convert units.
Why does it refuse some inputs?
The elements must fit: n × width cannot be more than the length. The width and the length must be above 0, the gap cannot be negative, and the page lists up to 1,000 elements. A number written as text or a value too large to compute is refused with a message instead of a wrong result.