Sphere packing calculator
Sphere packing asks how densely identical balls can be stacked, a question that runs from cannonball stacks to crystal structures and error-correcting codes. This calculator works out a simple cubic packing: it lays equal spheres on a regular grid inside a cubic box, with the centers spaced one diameter apart, and reports both how many spheres fit and the packing fraction, the share of the box volume that the spheres actually occupy. You provide the box side length and the sphere radius. The tool divides the box side by the sphere diameter and rounds down to count the spheres along each edge, cubes that to get the total number of spheres, then divides the total sphere volume by the box volume to get the fraction. Simple cubic packing is the most basic three-dimensional arrangement and, for a box that is an exact whole number of diameters across, it approaches the classic density of pi divided by 6, about 0.5236. Enter your own box and sphere sizes to plan storage, study a crystal lattice or check a problem. Every figure here is computed deterministically from the standard volume formulas, shown below with a worked example that reconciles exactly to the calculator.
Simple cubic packing fits floor(L / 2r) spheres per edge, and the packing fraction is total sphere volume over box volume. For a box of side 10 and sphere radius 1, it holds 125 spheres at a packing fraction of 0.5236 (about 52.36%).
Simple cubic packing formulas
spheres per edge n = floor( L / (2r) )
total spheres N = n^3
sphere volume = (4/3) pi r^3, box volume = L^3
packing fraction = N x (4/3) pi r^3 / L^3
ideal simple-cubic density = pi / 6 = 0.5236
The number of spheres along each edge is the box side divided by one sphere diameter, rounded down. Cubing it gives the total in three dimensions. The packing fraction is the combined volume of those spheres as a share of the whole box.
Worked example
Fit spheres of radius 1 into a cubic box of side 10 in a simple cubic arrangement.
- Diameter = 2 x 1 = 2
- Spheres per edge = floor(10 / 2) = floor(5) = 5
- Total spheres = 5^3 = 125
- Sphere volume each = (4/3) pi (1)^3 = 4.18879, total = 125 x 4.18879 = 523.5988
- Packing fraction = 523.5988 / 1,000 = 0.5236
The box holds 125 spheres at a packing fraction of 0.5236, the simple cubic ideal of pi over 6. These are the calculator's default inputs, so the results above match the widget exactly.
Packing fractions of common arrangements
| Arrangement | Packing fraction |
|---|---|
| Simple cubic | 0.5236 |
| Body-centered cubic | 0.6802 |
| Face-centered cubic / hexagonal close-packed | 0.7405 |
Face-centered cubic is the densest possible packing of equal spheres (Kepler conjecture).
Sphere packing calculator: frequently asked questions
What is sphere packing?
Sphere packing is the study of how to arrange equal-sized balls so they fill space as densely as possible without overlapping. The packing fraction, also called the atomic packing factor, is the proportion of the total volume that the spheres occupy. It governs how atoms stack in crystals and how objects pack in containers.
What is simple cubic packing?
Simple cubic packing places spheres on a regular three-dimensional grid with their centers one diameter apart along each axis, so each sphere touches six neighbors. It is the least dense regular arrangement, filling pi over 6, about 52.36 percent, of space. This calculator uses simple cubic packing inside a box.
Why is the packing fraction pi over 6?
In simple cubic packing each sphere of radius r sits at the center of a cube of side 2r. The sphere volume is four-thirds pi r cubed and the cube volume is eight r cubed, so the ratio is pi over 6, roughly 0.5236, independent of the radius. The whole grid inherits that same fraction.
What is the densest packing?
The densest packing of equal spheres is the face-centered cubic, or equivalently hexagonal close-packed, arrangement at a fraction of pi over the square root of 18, about 0.7405. That this cannot be beaten is the Kepler conjecture, proven in the early 2000s. Many metals crystallize in this densest form.
Does the box have to fit whole spheres?
This calculator counts only whole spheres that fit along each edge, rounding down, so a box that is not an exact whole number of diameters wide leaves a margin of empty space and the reported fraction dips below the ideal. For a box sized to an exact multiple of the diameter the fraction equals pi over 6 exactly. The worked example reconciles exactly to the calculator.
Official sources
- Materials structure and reference physical constants: US National Institute of Standards and Technology (NIST). As at 25 June 2026.
Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.