Last updated:

Sphere packing guide

How to Find the Optimal Box Dimensions to Pack 27 Spheres

The optimal box for packing 27 spheres of radius 2 cm is a 12 × 12 × 12 cm cube. With a sphere diameter of 4 cm, you fit a perfect 3 × 3 × 3 grid, giving a box volume of 1,728 cm³ and a minimum surface area of 864 cm². Because 27 = 3³, no rectangular box does it more efficiently.

27 spheres of radius 2 cm arranged in a 3 by 3 by 3 grid inside a 12 by 12 by 12 cm cube, showing volume 1728 cubic cm and surface area 864 square cm
27 spheres of radius 2 cm arranged in a 3 by 3 by 3 grid inside a 12 by 12 by 12 cm cube, showing volume 1,728 cm³ and surface area 864 cm²

That single line answers the most common version of the question. But "optimal" can mean smallest volume, minimum surface area, lowest material cost, or dimensions snapped to a 0.5 cm grid, and people also ask about other boxes (10×10×10, 12×12×11, 13×14×15) and other counts. This guide walks through the exact method so you can solve any version, then links to a calculator that does it instantly.

In a hurry? Skip to the Sphere Packing Calculator, enter your radius and count, and get the optimal box, surface area, and packing density in one click.

Table of Contents

Quick Answer at a Glance

Question Answer
Sphere radius2 cm (diameter = 4 cm)
Number of spheres27
Optimal arrangement3 × 3 × 3 grid (simple cubic)
Optimal box dimensions12 × 12 × 12 cm
Box volume1,728 cm³
Minimum surface area864 cm²
Packing density≈ 52.4% (simple cubic)
Dimensions are multiples of 0.5 cm?Yes: 12.0 qualifies

Why 27 Spheres Is a Special Case

The number 27 is a perfect cube: 27 = 3 × 3 × 3. That means the spheres line up into a flawless three-by-three-by-three lattice with no leftover space along any axis. Each sphere of radius 2 cm has a diameter of 4 cm, so three of them in a row span exactly 3 × 4 = 12 cm. Repeat that in all three directions and you get a 12 × 12 × 12 cm cube that holds all 27 with no gaps at the walls.

Key idea: Perfect cubes (8, 27, 64, 125) always pack into a tidy cube-shaped box. Awkward counts like 34 don't factor into three equal sides, so they force rectangular boxes with wasted space.

The General Formula: Spheres in Any Rectangular Box

For identical spheres packed in a simple cubic (grid) arrangement, the number that fits in a box is:

N = ⌊L / d⌋ × ⌊W / d⌋ × ⌊H / d⌋
where d = 2r is the sphere diameter, and ⌊ ⌋ means round down to the nearest whole number.

For radius-2 spheres, d = 4 cm, so it simplifies to:

N = ⌊L / 4⌋ × ⌊W / 4⌋ × ⌊H / 4⌋

To go the other way (finding the smallest box for a target count), factor the count into three whole numbers as close to equal as possible, then multiply each by the diameter:

CountFactoredOptimal box
82 × 2 × 28 × 8 × 8 cm
273 × 3 × 312 × 12 × 12 cm
644 × 4 × 416 × 16 × 16 cm

Step-by-Step: Finding the Optimal Box for 27 Spheres

Step 1: Get the diameter. Radius 2 cm means diameter d = 2 × 2 = 4 cm. Every sphere needs a 4 cm slot along each axis.

Step 2: Factor the count into three sides. You want three whole numbers that multiply to 27 and are as equal as possible. The only balanced option is 3 × 3 × 3. (You could use 1 × 1 × 27, but that makes a long, thin box with huge surface area: the opposite of optimal.)

Step 3: Multiply each side by the diameter. 3 spheres × 4 cm = 12 cm per side, giving 12 × 12 × 12 cm.

Step 4: Confirm volume and surface area. Volume = 12³ = 1,728 cm³. Surface area = 6 × (12 × 12) = 864 cm², the minimum achievable for 27 spheres in a rectangular box.

Tip: Always convert radius to diameter first. Forgetting to double the radius is the single most common mistake: it makes every box come out half the size it should be.

How Many Spheres Fit in Different Cube Sizes?

A common follow-up compares cube sizes: "What is the maximum number of radius-2 spheres in a 10×10×10 vs 11×11×11 vs 12×12×12 box?" Using spheres-per-side = ⌊side ÷ 4⌋:

Three cubes side by side: a 10 cm cube holds 8 spheres, a 12 cm cube holds 27 spheres, and a 16 cm cube holds 64 spheres
Three cubes side by side: a 10 cm cube holds 8 spheres, a 12 cm cube holds 27 spheres, and a 16 cm cube holds 64 spheres
Cube side (cm)Spheres per sideTotal spheres
828
1028
1128
12327 (optimal)
13327
14327
15327
16464

Notice the jump: anything from 8 cm up to 11.9 cm holds only 8 spheres, because you cannot fit a third 4 cm sphere until the box reaches a full 12 cm. From 12 cm through 15.9 cm you hold exactly 27. The extra centimetres past 12 are wasted until you reach 16 cm and unlock a 4 × 4 × 4 = 64 arrangement. That is why 12 cm is the precise optimal edge: the smallest size that fits all 27.

Can 27 Spheres of Radius 2 Fit in an 11 cm Cube?

No, not with standard grid packing. An 11 cm side only allows ⌊11 ÷ 4⌋ = 2 spheres per row, so an 11 × 11 × 11 cm cube holds just 2 × 2 × 2 = 8 spheres. You need a full 12 cm edge for the third layer in every direction.

Common misconception: A staggered close-packed arrangement can shorten one axis slightly, because nested layers sit lower than stacked ones. But staggering spreads spheres sideways: you lose in width what you gain in height, so the dimensions no longer land on clean, reliable numbers. For a guaranteed fit, 12 × 12 × 12 cm is the answer, and an 11 cm cube is not enough.

Worked Examples: Specific Box Dimensions

Here is how the formula handles the exact boxes people search for. Remember: radius-2 spheres need 4 cm per axis.

Box (cm)Per-axis fitSpheres heldHolds all 27?
12 × 12 × 123 × 3 × 327Yes (optimal)
11 × 11 × 112 × 2 × 28No
12 × 12 × 113 × 3 × 218No
12 × 11 × 113 × 2 × 212No
10 × 10 × 142 × 2 × 312No
10 × 11 × 122 × 2 × 312No
16 × 12 × 64 × 3 × 112No
13 × 14 × 153 × 3 × 327Yes (but wasteful)

Two takeaways. First, a box like 12 × 12 × 11 falls just short: that one missing centimetre drops you from 27 to 18 spheres. Second, 13 × 14 × 15 does hold 27, but it wastes material. Its surface area is 2 × (13·14 + 14·15 + 13·15) = 1,174 cm², far more than the cube's 864 cm². Bigger is not better when you are optimizing.

Minimum Surface Area: Why the Cube Wins

Many searches specifically ask for the box with minimum surface area for 27 spheres, useful when material or packaging cost is what you are minimizing. Among all rectangular boxes that hold a 3 × 3 × 3 grid, the cube has the lowest surface area because for a fixed volume a cube always minimizes surface area.

Box (cm)Holds 27?Surface area
12 × 12 × 12Yes864 cm² (minimum)
13 × 14 × 15Yes1,174 cm² (+36% material)
4 × 12 × 36Yes (1×3×9 grid)2,400 cm² (long and thin)

If your goal is the cheapest container by surface area, 12 × 12 × 12 cm at 864 cm² is the exact optimal answer, and no rectangular box beats it.

The "Multiples of 0.5 cm" Constraint

A frequent variant of this problem requires the box dimensions to be multiples of 0.5 cm. Good news: this changes nothing here.

Note: The optimal edge is exactly 12.0 cm, already a clean multiple of 0.5. You do not round up to 12.5 cm: that would only waste space. If a different count gave an ideal edge of, say, 13.3 cm, you would round up to the next 0.5 multiple (13.5 cm) to guarantee the spheres still fit. With 27 radius-2 spheres, no rounding is needed.

Packing Density: How Much Space Is Actually Used?

Even in the optimal cube, the spheres don't fill the box. Round objects always leave gaps. The packing density for a simple cubic (grid) arrangement is about 52.4%:

Comparison of simple cubic packing at 52.4 percent filled versus hexagonal close packing at 74 percent filled
Simple cubic packing at 52.4% density versus hexagonal close packing at 74% density

This is the theoretical maximum for grid-aligned spheres. A staggered close-packing arrangement (the way cannonballs or oranges stack) pushes density to about 74%, but that arrangement no longer fits a clean rectangular box. For boxed packing, 52.4% is your working figure. You can confirm the single-sphere volume with the Sphere Volume Calculator.

What About Other Sphere Counts (34, 36, 64)?

The same method scales to any count. Factor it into three near-equal whole numbers:

Rule of thumb: Perfect cubes (8, 27, 64, 125…) give the tidiest, most efficient boxes. Everything else trades a little efficiency for a rectangular shape.

Related Calculators

Working through a packing or volume problem? These tools pick up where this guide leaves off:

Frequently Asked Questions

What are the optimal box dimensions for 27 spheres of radius 2 cm?

A 12 × 12 × 12 cm cube. The 4 cm diameter spheres form a 3 × 3 × 3 grid (since 27 = 3³), filling the cube with no wasted edge space. Volume is 1,728 cm³ and surface area is 864 cm².

Can 27 spheres of radius 2 fit in an 11 cm cube?

No. An 11 cm edge fits only two 4 cm spheres per row, so an 11 × 11 × 11 cm cube holds just 8 spheres. You need a full 12 cm edge in every direction for all 27.

How many radius-2 spheres fit in a 12 × 12 × 11 cm box?

18 spheres. The two 12 cm sides hold three spheres each, but the 11 cm side only holds two (⌊11 ÷ 4⌋ = 2), giving 3 × 3 × 2 = 18.

What is the minimum surface area container for 27 spheres of radius 2?

The 12 × 12 × 12 cm cube, with a surface area of 864 cm². A cube minimizes surface area for a fixed volume, so no rectangular box that holds the 3 × 3 × 3 grid uses less material.

What is the formula for how many spheres fit in a box?

N = ⌊L/d⌋ × ⌊W/d⌋ × ⌊H/d⌋, where d is the sphere diameter (2 × radius). For radius-2 spheres, d = 4 cm, so divide each box dimension by 4, round down, and multiply.

Do the box dimensions need to be multiples of 0.5 cm?

If a problem requires it, you are covered. The optimal edge is exactly 12.0 cm, already a multiple of 0.5. No rounding up is necessary, and rounding to 12.5 cm would only waste space.

How many spheres fit in a 10 × 10 × 10 cube versus a 12 × 12 × 12 cube?

A 10 cm cube holds 8 spheres (2 per side), while a 12 cm cube holds 27 (3 per side). Capacity stays at 8 until the box reaches a full 12 cm, then jumps to 27.

What is the packing density inside the optimal box?

About 52.4%, the standard density for a simple cubic arrangement. The 27 spheres occupy roughly 905 cm³ of the 1,728 cm³ box.

What is the volume of the 12 cm cube?

1,728 cm³, calculated as 12³ (edge length cubed).

Key Takeaways

The optimal box for 27 spheres of radius 2 cm is a 12 × 12 × 12 cm cube: the direct result of 27 being a perfect cube and each sphere needing 4 cm of space. That cube gives the smallest volume (1,728 cm³), the minimum surface area (864 cm²), and satisfies any 0.5 cm precision rule without rounding. For any other count or box shape, the same approach works: convert radius to diameter, divide and round down to count spheres, or factor the target count into three near-equal sides to build the box.

When you want the answer in one step, the Sphere Packing Calculator handles every variation instantly.