Volume Calculator - Cube, Sphere, Cylinder, Cone, and Prism
Compute cubic measure for six common solids. Each result shows the formula that ran and uses π = Math.PI. Nothing is uploaded.
Solid and Dimensions
Default is a cylinder with r = 3 and h = 10. All lengths must be positive. π is JavaScript Math.PI, not a 22/7 fraction.
Volume Result
What Is a Volume Calculator and Why Do You Need One?
A volume calculator answers how much space a solid occupies. For the six shapes on this page the answers are closed formulas: a cube is s³, a rectangular prism is lwh, a sphere is (4/3)πr³, a right circular cylinder is πr²h, a right circular cone is (1/3)πr²h, and a square pyramid is (1/3)a²h. Those are not “rules of thumb.” They are the integrals of cross-sectional area, written in the form school and shop work actually uses.
People reach for a volume tool when packing a shipping crate, sizing a tank, converting a recipe that listed millilitres into a cylindrical jar, or checking a homework key that used 3.14 instead of a longer π. This page uses JavaScript Math.PI (about 3.141592653589793) every time π appears. It does not switch to 22/7 or 3.14 unless you type a dimension that already baked a rounded π into the length, which would be a different mistake.
Arithmetic stays in the browser. If you also need mass from volume, open the density calculator. If a triangular base area is the missing piece of a prism, solve the face with the triangle calculator first, then multiply by length yourself - this volume tool does not include an arbitrary triangular prism mode.
How to Use This Free Online Volume Calculator
Using this cube sphere cylinder cone prism tool takes four steps:
- Pick the solid that matches the object. A soup can is a cylinder, not a cone. A die is a cube. A basketball is a sphere, not a circle.
- Enter every required length as a positive number in the same unit. Radius is not diameter. Height for a cone or pyramid is the perpendicular height to the base, not a slant edge.
- Read the formula, the plugged-in substitution, and the numeric volume. The number is cubic in whatever unit you used for the lengths.
- Copy the result or clear the fields. Shape and dimensions are stored locally for up to 30 days.
Note: there is no unit dropdown. 3 cm and 3 m are both “3” to the formula, but 3³ cm³ is not 3³ m³. Convert first. Hollow shells, fillets, and a frustum of a cone are not implemented.
How to Calculate the Volume of a Cylinder
A right circular cylinder is a disk of radius r extruded straight through height h. The base area is πr², so the volume is that area times h. The default on this page is r = 3, h = 10, which is 90π ≈ 282.7433388230814 cubic units using Math.PI. If a problem gives diameter instead of radius, halve it before typing r. If it gives circumference C = 2πr, then r = C/(2π).
Oblique cylinders (the top is shifted sideways but the base stays a disk of radius r and the perpendicular height is still h) have the same volume by Cavalieri’s principle. This calculator does not ask for a slant: it always interprets h as the perpendicular height. A pipe with thickness is a difference of two cylinders, which you would compute twice and subtract by hand.
Sphere vs Circle - Volume Is Not Area
A circle lives in a plane. Its area is πr² (disk) or its circumference is 2πr (curve). A sphere is a 3-D solid (or, in some textbooks, the 2-D surface of that solid). The volume of a ball of radius r is (4/3) π r³. The exponent is three because you have three lengths. Squaring r and calling it volume is the most common mix-up on quizzes that mention both “circle” and “sphere” in one sentence.
Surface area of a sphere is 4πr², which this page does not compute. If you only needed a circular garden’s area, you are on the wrong tool. If you needed how much water a spherical tank holds, you are in the right place: type r, read (4/3)πr³. A hemisphere is half of that only when the flat face is included as a solid half-ball; an open hemispherical bowl is a different object.
Why a Cone Is One-Third of a Cylinder
Take a cone and a cylinder that share the same base radius r and the same perpendicular height h. The cylinder volume is πr²h. The cone volume is (1/3) π r² h. The factor 1/3 is not a compromise between 1/2 and 1/4. In calculus, horizontal slices of the cone have radius that shrinks linearly to zero, so area shrinks as (1 − z/h)², and ∫₀ʰ (1 − z/h)² dz = h/3. Euclid already knew the pyramid result; the cone is the circular-base version of the same one-third.
Guessing ½πr²h is a frequent error because a triangle is half a rectangle. A cone is not a triangle spun in a way that preserves that 1/2. If you need a sanity check: for r = 3, h = 10 the cone is 30π ≈ 94.24777960769379, exactly one-third of the default cylinder 90π.
Height must be perpendicular to the base. A slant height ℓ along the side of the cone is larger than h (unless r = 0). Pythagoras on a right triangle with legs r and h gives ℓ = √(r²+h²). This calculator never substitutes ℓ for h.
Why Volume Units Are Cubed
Length × length × length produces a cubic unit: m³, cm³, in³, ft³. Area is length × length (m²). Mixing them - reporting a tank as “200 square meters of water” - is dimensionally false. Litres are cubic: 1 L = 0.001 m³ = 1000 cm³. Gallons are also cubic; they are just a traditional name for a particular cubic inch count. This tool never converts among those names. If r is in inches and you wanted gallons, multiply the cubic-inch result by the conversion yourself.
Changing all linear dimensions by a factor k changes volume by k³. Double every edge of a cube and the volume becomes eight times larger, not twice. That scaling is why model ships and full-size ships do not hold water in a 1:1 ratio with their scale factor.
Pyramid vs Cone - Same One-Third, Different Base
| Solid | Base | Volume |
|---|---|---|
| Square pyramid | square, side a | V = (1/3) a² h |
| Cone | disk, radius r | V = (1/3) π r² h |
| Cylinder | disk, radius r | V = π r² h |
| Rectangular prism | rectangle l × w | V = lwh |
Any pyramid (or cone) is (1/3) × (base area) × (perpendicular height). A square pyramid’s base area is a². A cone’s base area is πr². If a pyramid had an equilateral-triangle base, the formula would still be one-third base area times height, but that solid is not a menu option here. A rectangular pyramid is also omitted. Do not approximate a cone by a pyramid with “many sides” inside this UI - pick Cone and use Math.PI.
Worked Examples - Cylinder, Cube, and Sphere
Cylinder r = 3, h = 10. V = π·9·10 = 90π. With Math.PI that is 282.7433388230814. This is the default load of the page.
Cube s = 2. V = 8. Not 6 (that would be surface area of a unit cube’s faces if you forgot the two hidden ones, or 6s² for s=1). Volume cares about the interior.
Sphere r = 1. V = 4/3 π ≈ 4.1887902047863905.Rectangular prism 2 × 3 × 4 is 24.Square pyramid a = 6, h = 9 is (1/3)·36·9 = 108. If any of those lengths is typed as 0 or −2, the calculator rejects the input rather than reporting a signed “volume.”
How to Calculate the Volume of a Cube and a Rectangular Prism
A cube is the special prism whose three edges are equal. If the side is s, V = s³. A 5 cm cube is 125 cm³, not 15 cm³ (that would be the sum of edges) and not 150 cm² (that would be six faces of 25). A rectangular prism - a shoebox - is V = lwh. Order of multiplication does not matter. If a problem gives area of the base and the height, that is already l·w, so volume is base area times height; this calculator still wants the three lengths separately in prism mode.
Cuboids in packaging often list only two outer dimensions plus “capacity in litres.” Capacity is an interior volume after wall thickness. This tool has no wall-thickness field. Measure the interior l, w, h or convert litres (1 L = 1000 cm³) before you compare with a printed label.
Radius vs Diameter for Sphere, Cylinder, and Cone
The formulas on this page all use radius r, not diameter. Diameter d = 2r, so a sphere becomes (4/3)π(d/2)³ = (1/6)π d³ if you insist on d. Typing the diameter into the radius box overstates a sphere by a factor of eight (because 2³ = 8) and a cylinder or cone by a factor of four (because 2² = 4). That is the single most expensive mix-up in tank sizing.
Circumference C = 2πr implies r = C / (2π). Use Math.PI in that division if you want to stay consistent with the volume π this page uses. A “radius” measured to the outside of a pipe is not the inner radius that holds fluid; again, this calculator does not subtract thickness.
Volume of a Square Pyramid - Formula and Height
For a pyramid with square base of side a and perpendicular height h, V = (1/3) a² h. The Egyptian-style slant height along a triangular face is larger than h. If a homework gives the lateral edge from apex to a base corner, that is still not h; drop a perpendicular from the apex to the base square (usually to the center) and use that length.
A rectangular pyramid would be (1/3)lwh. That is not in the menu. A triangular pyramid (tetrahedron) is (1/3) × (triangle area) × h; get the triangle area from the triangle calculator and multiply by h/3 yourself. Density problems - mass = density × volume - belong on the density calculator after you have a cubic number from here.
Tanks, Packing, and When These Volume Formulas Fail
A standing hot-water cylinder is close to V = πr²h if you ignore the dome. A grain silo with a conical hopper is a cylinder plus a cone; compute both rows and add. Cardboard shipping is usually a rectangular prism of outer size, which overstates interior volume. Spheres in a crate do not fill lwh - sphere packing leaves gaps; the formula (4/3)πr³ is one ball, not the crate.
Irregular bottles, human organs, and river channels need displacement, CAD mesh volume, or integration of a surveyed cross-section. This page will not estimate those. It also will not convert 90π cubic inches to gallons. Keep units honest, then convert with a factor you trust.
Honest Limits of This Volume Calculator
- Six solids only. No torus, ellipsoid, frustum, capsule, or triangular prism.
- Right heights. Cone and pyramid h is perpendicular to the base, not slant.
- No unit conversion and no millilitre/gallon labels. The output is a pure number in cubic input-units.
- IEEE-754 π. Math.PI is not a symbolic constant; very large r³ can overflow to Infinity.
- Positive lengths only. Empty, zero, and negative dimensions error.
Frequently Asked Questions (FAQ) - Volume Calculator
How do you find the volume of a cylinder?
A right circular cylinder has volume V = π r² h: the circular base area π r² times the height h. This calculator uses JavaScript’s Math.PI for π. Default example: r = 3, h = 10 gives 90π ≈ 282.7433388230814 cubic units.
What is the difference between a sphere and a circle?
A circle is a 2D disk’s boundary (or the disk, in casual speech) with area π r². A sphere is a 3D solid (or its surface) with volume (4/3) π r³. You cannot get sphere volume from circle area alone without a third dimension - the radius still appears cubed, not squared.
Why is the volume of a cone one-third of a cylinder?
A cone with the same base radius and height as a cylinder has V = (1/3) π r² h. Cavalieri’s principle / the disk method in calculus shows the cross-sections scale as (1 − z/h)², and that integral is 1/3 of the cylinder. It is not 1/2; that guess is a common homework error.
Why are volume units cubed?
Volume is three lengths multiplied (or an integral of area along a third axis). If r and h are in meters, V is in m³, not m². Mixing cm with m without converting will be off by 100³ = 1,000,000 for a cube. This tool does not convert units; it only multiplies the numbers you enter.
What is the difference between a pyramid and a cone?
Both are (1/3) × base area × height. A square pyramid here uses a square base of side a, so V = (1/3) a² h. A cone uses a circular base, so V = (1/3) π r² h. A cone is not a pyramid with infinitely many sides in this calculator - it is the circular formula with Math.PI.
Does this volume calculator upload my numbers?
No. The arithmetic runs in your browser with JavaScript. Nothing is sent to a server. After the page loads, the tool still works if the network drops. The last shape and dimensions are stored only in localStorage on this device for up to 30 days.
Why Choose Our Volume Calculator?
- Free, no account. Cube, prism, sphere, cylinder, cone, square pyramid.
- Private. Dimensions never leave this browser.
- Formula shown next to the number so you can quote V = π r² h, not only a decimal.
- Math.PI instead of a silent 3.14.
- Rejects non-positive lengths instead of printing a negative volume.
- Works offline after the first page load.
Related Tools
Discover more free developer tools that might interest you.
Area Calculator
Calculate area of squares, rectangles, triangles, circles, and more
Use ToolAverage Calculator
Calculate mean, median, mode, and range from a list of numbers
Use ToolBasic Calculator
Add, subtract, multiply, and divide with a free online calculator
Use ToolBig Number Calculator
Add, subtract, multiply, and divide integers too large for a standard calculator
Use ToolBinary Calculator
Add, subtract, and convert binary numbers to decimal and hex
Use ToolCircle Calculator
Find radius, diameter, circumference, area, arc length, and sector area
Use Tool