Skip to content
CalcSpectrum

Volume Calculator

Calculate the volume of a cube, rectangular prism, cylinder, or sphere from its dimensions, with the exact formula used shown alongside the result.

Free to use · Instant results
Loading calculator…

How It's Calculated

Formula

\text{Cube: } V = s^3\\ \text{Rectangular Prism: } V = l \times w \times h\\ \text{Cylinder: } V = \pi r^2 h\\ \text{Sphere: } V = \frac{4}{3} \pi r^3

This calculator computes the volume of four common 3D shapes: a cube, a rectangular prism, a cylinder, or a sphere. Pick a shape first — that choice determines which of the three dimension fields below are actually used and what each one means. A cube needs only its side length (s) and uses V = s³. A rectangular prism needs all three dimensions — length (l), width (w), and height (h) — and uses V = l × w × h. A cylinder needs a radius (r) and a height (h) and uses V = π × r² × h. A sphere needs only a radius (r) and uses V = (4/3) × π × r³. Any dimension field not needed by the shape you've selected is ignored, no matter what value sits in it. Every dimension that IS relevant to your selected shape must be greater than 0 — a zero or negative relevant dimension isn't a real measurement and is rejected rather than silently producing a zero or negative volume.

Worked Examples

Cube with side length 3

  1. Shape: Cube. Dimension 1 (side, s) = 3.
  2. Formula: V = s³
  3. V = 3³ = 3 × 3 × 3 = 27
  4. Volume = 27 cubic units.

Cylinder with radius 2 and height 5

  1. Shape: Cylinder. Dimension 1 (radius, r) = 2, Dimension 2 (height, h) = 5.
  2. Formula: V = π × r² × h
  3. V = π × 2² × 5 = π × 4 × 5 = 20π
  4. 20π ≈ 62.8319 cubic units.

Frequently Asked Questions

Why are there three generic "Dimension" fields instead of labeled fields like "radius" or "height"?

This calculator uses one universal form layout to support many shapes without duplicating the interface for each one. Because the four supported shapes need different numbers and kinds of measurements, the three dimension fields are generic and their meaning changes based on the shape you select — Dimension 1 is a side for a cube but a radius for a cylinder or sphere, for example. Each field's helper text spells out exactly what it means for every shape.

What happens to a dimension field a shape doesn't need?

It's ignored completely. For example, a cube only uses Dimension 1 (its side length) — whatever is in Dimension 2 or Dimension 3 has no effect on the result, even if you leave old values sitting in those fields from a previous shape.

Which fields does a cylinder actually use?

A cylinder uses Dimension 1 as its radius and Dimension 2 as its height. Dimension 3 is not used and is ignored for a cylinder.

Why does the calculator reject a dimension of 0?

A side length, radius, width, or height of 0 collapses the shape to zero or negative size in that dimension, which isn't a real measurement — it isn't "a very small shape," it's not a shape at all. Every dimension relevant to your selected shape must be strictly greater than 0.

Does this calculator support cones, pyramids, or other solids?

Not yet. This version supports exactly four shapes — cube, rectangular prism, cylinder, and sphere — chosen as the initial, most commonly needed set. Other solids may be added as separate future work.