To find the volume of a rectangular prism in gallons, multiply length × width × height to get cubic inches, then divide by 231 — because one US liquid gallon equals exactly 231 cubic inches. The geometric formula V = l × w × h fills a box by stacking the rectangular base (l × w) through the height h, and the conversion step translates that cubic answer into a liquid measure that matters in everyday life. A 24 × 12 × 16-inch aquarium, for instance, holds 24 × 12 × 16 = 4,608 cubic inches, which is 4,608 ÷ 231 ≈ 19.95 US gallons. The free Rectangular Prism Volume Calculator returns the cubic volume instantly from any three edge lengths, and the conversion factors below turn that result into gallons whether you measured in inches, feet, centimetres, or metres. This two-step process — calculate the cubic volume, then convert to gallons — is what aquarium keepers, gardeners filling a planter reservoir, and homeowners sizing a water-storage tank use to get a practical liquid capacity from any box they can measure with a tape.

The Formula Behind Rectangular Prism Volume
The volume of any rectangular prism — also called a cuboid or, more casually, a box — comes from one of the simplest and most useful formulas in geometry:
V = l × w × h
The idea is that the base of the box is a rectangle of area l × w, and the height h stacks that base upward through space. Multiplying the three perpendicular edges gives the volume of space enclosed, regardless of whether you measure in inches, feet, centimetres, or metres. The result is always in cubic units of whatever unit you used for the sides: inches give cubic inches, centimetres give cubic centimetres, metres give cubic metres.
A cube is just the special case where length, width, and height are all equal. When l = w = h = s, the formula collapses to the familiar V = s³. The Rectangular Prism Volume Calculator handles both cases automatically and flags the cube case for you.
Measuring a Rectangular Prism for Liquid Capacity
When the goal is gallons rather than geometric volume, measurement details start to matter. Use the inside dimensions of the container, not the outside, because glass, plastic, and wood walls all take up space that water cannot fill. For a wooden planter or a thick-walled storage tote, the difference between inside and outside measurements can shift the gallon answer by 10% or more.
Measure all three edges in the same unit. If your tape is in inches but the height is taller than the tape reaches, mark a halfway point and double rather than switching units mid-measurement — mixed-unit inputs are easy to mis-translate later. Length, width, and height can be whole numbers or decimals; the calculator accepts either, and the inputs must be zero or positive.
For a typical rectangular fish tank, planter reservoir, or storage tub, the dimensions you want are:
- Length — the longest horizontal edge along the bottom inside.
- Width — the shorter horizontal edge along the bottom inside.
- Height (or depth) — the vertical distance from the bottom inside to the fill line or rim, not to the lid.
Do not fill the container to the brim. Leave an air gap of roughly an inch or two if the container has a lid, and subtract the volume of any substrate (gravel, soil, sand) that displaces water in tanks and planters.
Calculate Rectangular Prism Volume in the Calculator
- Measure the inside length of the container in inches (or another consistent unit). For this example, use 24 inches.
- Measure the inside width in the same unit. For this example, use 12 inches.
- Measure the inside height (or depth) in the same unit. For this example, use 16 inches.
- Open the Rectangular Prism Volume Calculator and type each value into the length, width, and height fields.
- Read the volume, surface area, and space diagonal as they update in real time. The volume field shows 4,608 cubic inches for the example values.
- Convert cubic inches to gallons using the table in the next section: 4,608 ÷ 231 ≈ 19.95 US gallons.
Converting Cubic Units to Gallons
The calculator returns a cubic-unit answer. To read that answer in gallons, apply a single conversion factor that depends on the unit you measured in. The most common case — US liquid gallons from cubic inches — uses the constant 231, set by the US wine gallon in 1707 and still the official US liquid gallon today. Imperial (UK) gallons use a different constant, so confirm which gallon your project needs before converting.
| Starting unit | To get US gallons | Operation |
|---|---|---|
| Cubic inches (in³) | US gal | Divide by 231 |
| Cubic feet (ft³) | US gal | Multiply by 7.4805 |
| Cubic centimetres (cm³) | US gal | Divide by 3,785.41 |
| Litres (L) | US gal | Multiply by 0.26417 |
| Cubic metres (m³) | US gal | Multiply by 264.172 |
For the worked example above, the volume is 4,608 cubic inches. Dividing by 231 gives 19.9480…, which rounds to roughly 19.95 US gallons. The same aquarium measured in feet (2 ft × 1 ft × 1.333 ft) gives 2.667 ft³, which at 7.4805 gallons per cubic foot rounds to the same 19.95 — the answer does not depend on the unit, only the conversion does.
If your project requires imperial (UK) gallons instead, divide cubic inches by 277.42 or multiply litres by 0.21997. Fuel, brewing, and some older aquarium references use imperial gallons, so check which system applies. The How to Calculate Cylinder Volume in Gallons guide walks through the same conversion for round tanks, and the How to Convert Area to Gallons: Add Depth First article covers the related path of measuring a base area and multiplying by depth.
Where Gallon Capacity Shows Up in Real Life
Almost every box-shaped container that holds liquid gets its gallon rating from the formula and conversion above. A few of the most common cases:
- Aquariums. Standard tank sizes — 10, 20 long, 29, 55, 75 gallons — are rounded from the cubic volume of their nominal inside dimensions. The rounded labels are close to but rarely exactly equal to the geometric answer.
- Raised garden beds and planter reservoirs. Soil volume uses the same formula, but the liquid capacity of a self-watering reservoir or wicking bed uses the inside dimensions of the water chamber, not the soil chamber.
- Water-storage tanks and cisterns. Rectangular utility tanks in RVs, basements, and off-grid setups are sized by inside length, width, and height; the label on the tank is usually rounded down for safety.
- Concrete footings and slab forms. Cubic-yard volume for ordering concrete uses the same formula in feet, then divided by 27 (cubic feet per cubic yard).
- Shipping and dimensional weight. Carriers bill by the box's volume, not its mass, so the rectangular-prism calculation drives the cost of moving a shipment even when nothing liquid is involved.
The common thread is that the volume formula is identical, and only the final unit conversion changes. Getting the cubic volume right with the Rectangular Prism Volume Calculator first, then applying the right conversion, covers almost every practical case.
Common Measurement Mistakes That Throw Off the Gallon Answer
Most gallon miscalculations come from one of a handful of measurement and conversion slips. The four most common:
- Mixing units. Entering inches for two sides and feet for the third gives an answer that is off by a factor of 12 or 144. Convert all three edges to the same unit before calculating.
- Using outside dimensions. A container measured on the outside will always overstate the true liquid capacity by the volume of the walls. For water, fuel, or any liquid, always measure inside.
- Forgetting the air gap. A container filled to the brim spills. The usable liquid volume is the volume up to the fill line, not up to the lid or rim.
- Confusing US and imperial gallons. A UK imperial gallon is about 1.2 US gallons, so a recipe or product spec written for one system will be wrong by roughly 20% if applied to the other.
The check that catches almost every error: take the final gallon answer and multiply it by the conversion factor in reverse to recover the cubic inches. If the recovered cubic inches match the calculator output, the chain is correct.