Audited 05 Aug 2026·Last updated 28 Oct 2026·3 citations·Tier 2·0 uses

Cubic In Cylinder Calculator

Find the side of the largest upright cube that fits inside a cylinder of given radius (side = r√2) and how much of the cylinder's volume it fills.

Cubic In Cylinder Calculator

Largest centred cube side
7.0711
Side length of the largest upright, centred cube that fits within the cylinder's radius, in the same unit as the radius.
Cube/cylinder volume ratio
63.66

Background.

Fitting a square inside a circle is one of the oldest practical problems in geometry. A sawyer squaring a round log, a machinist milling a square section from round bar and a packer sliding a box into a drum are all asking the same thing: how big can the square be before its corners hit the curve?

For a cube standing upright in a cylinder, the answer depends only on the radius. Look down the cylinder's axis and the cube becomes a square sitting inside a circle. The largest such square touches the circle at all four corners, so its diagonal runs straight across the circle and equals the diameter. A square's diagonal is its side times √2, so the side is the diameter divided by √2, which simplifies to the radius times √2: about 1.414 × r, or 0.707 of the diameter.

The share of space used is the same at every size. The square covers 2/π of the circle, about 63.66%, and since the cube and the matching slice of cylinder have equal height, the cube fills 63.66% of that slice's volume too. The other 36.34% is the four curved slivers between the cube's faces and the wall. Turn the problem around, a round peg in a square hole, and the fit is better: a circle fills π/4, about 78.5%, of the square around it.

Two assumptions are built in. The cube is centred and upright, its faces parallel to the cylinder's axis; tilted or rotated placements are not considered. And the cylinder is taken to be at least as tall as the cube's side. If it is shorter than about 1.414 times its radius, height becomes the limit and the cube must be smaller than the figure shown.

What is cubic in cylinder calculator?

The inscribed cube here is the largest cube that can stand upright and centred inside a right circular cylinder, with its four vertical edges touching the curved wall. Its side length is r√2, where r is the cylinder's radius. The companion figure is the cube's volume as a percentage of a section of the cylinder exactly as tall as the cube, which works out to 2/π, about 63.66%, whatever the radius.

How to use this calculator.

  1. Enter the cylinder's radius, half its diameter. A measured diameter of 10 cm goes in as 5.
  2. Any length unit works, and the cube side comes back in the same unit, so millimetres in means millimetres out.
  3. For a container, pipe or bore, measure the inside diameter, because the cube has to clear the inner face of the wall.
  4. Check that the cylinder is at least 1.414 times its radius tall. If it is shorter, height limits the cube and its side cannot exceed that height.

The formula.

For a cube spanning a cylinder diameter, side=r√2

side = r × √2. Viewed from above, the cube is a square inscribed in a circle of radius r. The square's diagonal is a diameter of the circle, 2r, and by Pythagoras the diagonal of a square of side s is s√2. Setting s√2 = 2r gives s = 2r ÷ √2 = r√2, with √2 ≈ 1.41421.

The fill ratio compares the cube's volume s³ with a cylinder of the same height, πr² × s. Dividing, s³ ÷ (πr²s) = s² ÷ πr² = 2r² ÷ πr² = 2/π, about 63.66%. Because the radius cancels, every cylinder gives the same ratio; only the side length scales, in direct proportion to r. Mixing up radius and diameter is the one mistake that matters, and it doubles or halves the side.

A worked example.

Example

A cylinder of radius 5 (diameter 10, in any unit) needs the largest cube that will stand upright inside it. The square cross-section's diagonal must equal the diameter, 10, so the side is 10 ÷ √2 = 5 × √2 ≈ 7.0711. As a check, 7.0711 × 1.41421 brings the diagonal back to 10. The cube's volume is 7.0711³ ≈ 353.55 cubic units. A slice of the cylinder 7.0711 tall holds π × 5² × 7.0711 ≈ 555.36, so the cube fills 353.55 ÷ 555.36 = 63.66% of it. If the cylinder were a full 10 units tall, the same cube would occupy only about 45% of it.

cylinder Radius5

Frequently asked questions.

What size square beam can be cut from a round log?
The largest square section has a side equal to the log's diameter divided by √2, about 0.707 times the diameter. A 30 cm log gives a beam about 21.21 cm square, and the slabs cut away carry about 36.3% of the wood. Measure the small end, since taper, bark and saw kerf all reduce the real beam.
Why is the fill ratio 63.66% whatever radius I enter?
Both volumes grow with the cube of the size, so the radius cancels out of the ratio. What remains is 2/π, the area of a square inscribed in a circle divided by the area of that circle. Only the cube side changes as the radius changes, in direct proportion to it.
Does a round peg fit a square hole better than a square peg fits a round hole?
Yes. A circle inscribed in a square fills π/4, about 78.5%, of it, while a square inscribed in a circle fills 2/π, about 63.7%. In two dimensions the round peg wastes less space, and the cube-in-cylinder ratio on this page is the 63.7% case stretched upward into a prism.
What if the cylinder is shorter than the cube would be?
Then height rather than width limits the cube. The width allows a side of r√2, but an upright cube can never be taller than the cylinder, so in a short cylinder its side equals the height. For a radius of 5, any cylinder shorter than about 7.07 is in that situation.
Should I measure the inside or the outside of a pipe?
The inside. The cube's vertical edges touch the inner wall, so the internal radius is what limits it. On a pipe with a 3 mm wall, using the outside diameter would overstate the cube side by about 4.24 mm, the wall thickness multiplied by √2.
How long are the diagonals of the inscribed cube?
The diagonal across the top face equals the cylinder's diameter, 2r, because it spans the circle corner to corner. The longest internal diagonal, from a bottom corner to the opposite top corner, is the side times √3, which is r√6, about 2.449 times the radius.

How this page was produced

Published by
Quanta Calculator
Primary sources
3 cited below
Method
For a cube spanning a cylinder diameter, side=r√2
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon