How to use the circle packing calculator
- Enter the width and height of the container in one unit, and the diameter of the round items.
- Add a space between items if they need a gap, or leave it at 0 if they may touch.
- Read the most items that fit, the count for the square grid and the staggered layout, and the unused area of each.
- Use the steps to see how many items sit in each row of the best layout.
Formula
Spacing p = diameter + gap
Square grid = (floor((W - d) / p) + 1) x (floor((H - d) / p) + 1)
Staggered rows are p x sqrt(3) / 2 apart, so rows = floor((H - d) / (p x sqrt(3) / 2)) + 1
Full rows hold floor((W - d) / p) + 1 items and shifted rows hold floor((W - d - p / 2) / p) + 1
The staggered layout is tried with the rows running along the width and along the height, and the larger count is shown. The unused area is 1 minus the area of the circles over the area of the container.
Discs on a sheet and items in a tray
A container 20 by 10 holds 18 items 3 wide in a square grid (6 across and 3 rows). The staggered layout also holds 18, with three rows of 6, so there is a tie. Discs 8 across with a 2 gap, spacing 10, on a 100 by 60 sheet fit 60 in a square grid and 67 when staggered, an improvement of 7 items.
A 12 by 12 tray with 1.5 items and a 0.25 gap, spacing 1.75, takes 49 in a square grid and 46 staggered, so the square grid is better there. The result lists the better layout and the unused area of each.
Which layout wins
The staggered layout has a higher density for large containers, about 90.7 percent of the area against 78.5 percent for a square grid, but it needs room for the half shifted rows, and for small containers the square grid can win. That is why the page shows both counts instead of assuming one.
For rectangles instead of circles, use the pieces per sheet calculator. The circle calculator gives the area of one item.
Checking a layout
The counts are checked in testing by placing every center and confirming that no two centers are closer than the spacing and that every circle lies inside the container. For production work, leave an allowance for the cutter or punch and for the edge of the sheet, which you can enter as extra space between items.
Assumptions and limits
- All items are circles of the same diameter, and the container is a rectangle.
- Only a square grid and a staggered (hexagonal) layout are counted. More irregular arrangements may fit more.
- The gap is the clear space between neighbors, and items may touch the container wall.
- The page stops at about 250,000 items to stay fast.
Frequently asked questions
How many circles fit in a rectangle?
Divide the width and height by the spacing for a square grid, or use staggered rows spaced 0.866 times the spacing apart. The page does both and shows the larger count.
Is staggered packing always better?
No. For large containers it fits more, but in a small container the shifted rows can lose an item at the end of each row, and the square grid can win, as it does for a 12 by 12 tray.
How do I allow for a cutting gap?
Enter the gap between items in the space field. The spacing between centers is then the diameter plus the gap.
Does this find the best possible packing?
No. It counts two regular layouts. Special arrangements for specific container sizes can sometimes fit more items.