Sphere Packing Calculator
Estimate how many balls fit in a container, or how much of a container a given number of spheres fills. Choose a packing arrangement - simple cubic, random pour or close-packed - and get the count, fill fraction and left-over space.
Formula: N = packing fraction × Vcontainer ÷ Vsphere
How sphere packing fractions work
Spheres can never fill a container completely - gaps remain no matter how they are arranged. The share of space the balls occupy is the packing fraction, and it depends on how they settle. The densest possible arrangement, face-centred cubic (also called close packing or tetrahedral stacking), reaches 74.05%. Pouring balls loosely into a jar lands near 64% on average, and a naive grid where each ball sits directly above another manages only 52.36% - exactly π/6.
The calculator divides the container volume by a single sphere’s volume, then multiplies by the chosen packing fraction: N = f × Vcontainer ÷ Vsphere. For 5 cm balls in a 60 × 40 × 30 cm box (72,000 cm³), each ball holds 65.45 cm³, so a random pour gives 0.64 × 72,000 ÷ 65.45 ≈ 704 balls. The remaining 36% is air between the spheres.
Two caveats matter at the walls. First, a container whose dimensions are not whole multiples of the ball diameter wastes partial rows, so very small containers fall short of the statistical estimate - the grid count shown in the results is a useful cross-check. Second, the wall effect: near a flat wall, balls cannot achieve the ideal local arrangement, which drags real packing fractions down a few percent in narrow containers. For containers only a few ball-diameters wide, subtract roughly 5–10% from the estimate.
How to use this calculator
- Pick the packing arrangement. Random pour suits balls tipped into a container; close-packed suits deliberately stacked or vibrated loads; simple cubic models a loose aligned grid.
- Enter the sphere diameter. Measure the widest point of a typical ball.
- Enter the container’s inner dimensions. Use internal measurements so wall thickness does not inflate the answer.
- Compare the estimates. The results show the statistical count, the volume of trapped air and a strict aligned-grid count to bracket the true answer.
The science behind the numbers
Random pour versus random close packing
Balls tipped into a jar settle into a disordered arrangement around 60–64% dense. Shaking or vibrating the container compacts them toward about 64%, the practical ceiling for disorder. Ordering even small clusters of balls into local tetrahedral patterns pushes higher; pouring through a funnel or adding them under liquid can nudge the fraction up a point or two.
Why 74.05% is the limit
Face-centred cubic and hexagonal close packing both place each sphere touching twelve neighbours, filling exactly π/√18 ≈ 74.048% of space. Kepler conjectured in 1611 that nothing does better; Thomas Hales proved it in 1998 with a computer-assisted proof. Real bulk goods never reach this systematically, but ordered layers of fruit, ball bearings or shot can come close.
The wall effect in small containers
Against a flat wall the ideal twelve-neighbour arrangement cannot form, so balls near the boundary sit less densely. In a container a few diameters across this boundary layer dominates and real counts land well below the statistical estimate; in a container twenty diameters wide the effect is a percent or two. Rule of thumb: containers under about five diameters wide deserve a 5–10% haircut on the estimate.
Packing other shapes
Identical circles in a plane pack to 90.69% when hexagonally arranged - much better than spheres in space. M&Ms (spheroids) randomly pack near 68%, better than spheres because elongation lets them interlock. Cubes, being space-filling, reach 100%.
From pour to ordered stack: the fractions in between
The fractions quoted above are endpoints, not a fixed menu. A casual pour lands near 56–60%; tapping the container repeatedly settles the bed toward 62–64%; layer-by-layer placement with each ball nestled between two below it approaches 0.7405 but only in an ordered lattice. Anything between is possible, which is why the calculator treats the fraction as an input rather than assuming one value. If you know your packing method - poured, shaken, hand-stacked - pick the matching fraction; if you only need an order of magnitude, 64% is the safest default for poured spheres.
Mixing sizes raises the fraction
A bed of identical spheres has voids of one characteristic size. Pouring smaller spheres in on top lets them partially fill those voids: a 2:1 diameter ratio can push the overall fraction toward 75–80%, and a well-graded mix spread over several sizes can exceed 85%. This is exactly why graded gravel compacts harder than uniform pebbles, and why concrete blends coarse and fine aggregate. The calculator assumes identical spheres, so mixed-size fills must be estimated by splitting the container into size-dominated regions and summing the counts.
Counting layers in shallow trays
When the container is only a few ball-diameters deep, think in layers instead of fractions. A 30 × 30 cm tray of 10 cm balls fits 3 × 3 = 9 per aligned layer and 3 layers, so 27 balls - a packing fraction of just π/6 ≈ 52%. Nesting the second layer’s balls in the gaps between the first can squeeze in a few more but wastes edge space, so for shallow trays the aligned-row count is the reliable answer.
Packing fractions at a glance
| Arrangement | Packing fraction | Typical use |
|---|---|---|
| Simple cubic (aligned grid) | 52.36% (π/6) | Theoretical baseline, stacked columns |
| Random loose pour | 56–60% | Balls poured gently, no settling |
| Random close packed / vibrated | 60–64% | Jars of marbles, bulk shipping |
| Ordered layers (partial) | 65–72% | Hand-stacked fruit, shot towers |
| Close packed (fcc / hcp) | 74.05% (π/√18) | Maximum possible; crystal lattices |
Example counts of 5 cm balls per 100 litres of container volume: simple cubic 787, random pour 970, close-packed 1,114.
Convert a fraction into an expected count with count = fraction × container volume ÷ ball volume. One cubic metre at 64% holds 640 litres of sphere volume: about 1,220 ten-centimetre balls, 362 marbles of 15 mm per litre, or 725 in a two-litre jar. Diameter dominates because ball volume grows with its cube - halving the diameter multiplies the count by eight at the same packing fraction.
Where sphere packing matters
Shipping balls and produce
Wholesalers of ball bearings, pebbles or oranges estimate box counts by dividing packed volume by unit volume and applying the appropriate fraction. A pallet cavity of 1 m³ holds about 970 ten-centimetre oranges loosely, or up to 1,114 if hand-stacked in layers.
Wall effects and container shape
A container only a few ball-diameters wide wastes wall space on every side: a jar five diameters across packs several percent below 64%, and a narrow tube may fall toward 55%. The penalty shrinks rapidly with size - by ten diameters the deficit is under 2% - so for large containers the bulk fraction can be used as-is, while small jars and vials deserve a conservative reduction.
Bed media and catalysts
Industrial columns filled with ceramic spheres or catalyst balls quote both the solid volume and the void space, because fluid flows through the gaps. Engineers compute void fraction directly from the packing fraction: a 64% packed bed has 36% free volume for flow.
Storage jars and retail packs
Marble, gumball and ball-pack retailers size containers with exactly this arithmetic. A 2-litre jar of 15 mm marbles holds roughly 0.64 × 2,000 ÷ 1.77 ≈ 725 marbles - which is why "over a thousand marbles" claims on small jars rarely survive measurement.
Aggregate and gravel ordering
Landscape suppliers sell gravel by volume, but it arrives as stones with air between them. A tonne bag nominally holding 0.6 m³ of 20 mm stone contains about 0.64 × 0.6 ≈ 0.38 m³ of solid rock, and it consolidates further once compacted into a path. Estimating coverage with the packed fraction avoids the classic mistake of ordering loose volume and finding the job one-third short.
Inventory counts for ball stock
Warehouses count stock by weighing rather than counting: weigh a sample of twenty balls, divide, and the total mass over the unit mass gives the count. The packing estimate cross-checks that number - a pallet recorded as holding 3,000 ten-centimetre balls should occupy roughly 3,000 × 0.524 ÷ 0.64 ≈ 2.4 m³ of packed space, and a large discrepancy flags a data entry error before it reaches an invoice.
Common mistakes & pro tips
- Assuming 100% fill. Spheres always leave gaps; using container volume as ball volume overestimates by 26–48% depending on arrangement.
- Wrong radius in the sphere volume. Unit ball volume is πd³/6 from the diameter - substituting the diameter as a radius overstates it eightfold.
- Using outer container dimensions. Wall thickness eats capacity; measure inside faces only.
- Trusting the estimate in tiny containers. Under about five ball-diameters wide, wall effects cut real counts several percent below the statistical figure.
- Confusing shake-down with close packing. Vibrating a jar reaches about 64%, not 74.05% - the densest figure requires ordered stacking, not just settling.
- Counting solid volume as packed volume. 1,000 balls of 524 cm³ each do not need a half-cubic-metre container - at 64% packing they fill about 0.82 m³. Apply the fraction in the right direction.