ForHosting KIT · Math

Pyramid volume calculator

Enter the height and the base of a pyramid and get its volume: a square base of side 6 and a height of 4 give 48, with a slant height of 5 and a total surface of 96. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Side
6
Height
4
You get
Base area
36
Volume
48
Base shape
square
Formula volume
V = (1/3) · base_area · h

This calculator turns a positive pyramid height plus a base description into the solid-geometry metrics you need for homework, design, and code. When the base is square it also reports the face slant height from the Pythagorean relation with half the side, the four-face lateral surface area, and the total surface that adds the square base.

One volume rule for every base

A pyramid is a solid with a polygonal base and triangular faces that meet at a single apex. Its volume is always one third of the base area multiplied by the height, and the height is the perpendicular distance from the apex straight down to the plane of the base. That rule does not care whether the base is a square, a rectangle or any other polygon whose area you already know, so you can describe the base in three ways: its area alone, the side of a square, or the length and width of a rectangle. With a square base you also get the slant height of each face, the area of the four faces and the total surface including the base. A square base of side 6 with a height of 4 gives a base area of 36, a volume of 48, a slant height of 5, a lateral area of 60 and a total surface of 96.

Mistakes that change the answer

Using the slant height where the vertical height belongs inflates the volume, because the slant height runs along a face and is always longer. Forgetting to divide by three gives the volume of a prism with the same base and height, three times too large. The lateral area and the total surface are not the same figure either: the total adds the base, which is why the square example jumps from 60 to 96. The height has to be positive, so a zero or negative value stops with an error instead of a silent result. Results are rounded to the number of decimals you choose, from 0 to 15, with 10 by default.

Homework and exam preparation

Compute pyramid volume from base area or dimensions and height, and for a square base also slant height and surface areas; verify that non-positive height is rejected.

Roofs, monuments, and packaging design

Size pyramidal roof volume, monument mass from density, or packaging pyramid material from known base dimensions and height in CAD and manufacturing tools.

What does the pyramid volume calculator cost?

It is free in your browser on this page.

When are slant height and surface areas returned?

Only for a square base (side provided, or length equals width). Slant height is √(h² + (a/2)²); lateral surface is 2 · a · l; total surface is base plus lateral.

How do I calculate the volume of a pyramid?

Multiply the base area by the height and divide by three. A square base of side 6 has an area of 36, so with a height of 4 the volume is 36 times 4 divided by 3, which is 48.

What is the slant height of a square pyramid?

It is the height of one triangular face, from the middle of a base edge up to the apex. It comes from Pythagoras with the height and half the side, so a height of 4 and half a side of 3 give 5.

Can I use a rectangular or irregular base?

Yes. Give the length and width of a rectangle, or just the base area for any other shape, and you get the volume. The slant height and the surface areas are only worked out for a square base.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/geom/pyramid

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/geom/pyramid \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"height":4,"side":6}'
{
  "height": 4,
  "side": 6
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.pyramid",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Give base_area alone, a square side length, or rectangular length and width; the engine always returns volume as one-third times base area times height. Every successful response echoes the resolved base_area, height, volume, base_shape, and the volume formula so a student or a log line can verify the identity without reading the source. Non-positive height, missing base data, or non-finite numbers raise invalid_input instead of a silent NaN. Through the API a successful request costs $0.002; validation failures are not charged.

What a pyramid calculator returns and how base and height combine

A pyramid is a polyhedron with a polygonal base and triangular faces that meet at a single apex. The perpendicular distance from that apex down to the base plane is the height h, and the classic volume formula is always one-third of the product of the base area and that height, regardless of whether the base is a square, a rectangle, or any other polygon whose area you already know. This tool exists to turn those inputs into a single deterministic response without forcing you to look up which third of the prism volume applies, how slant height is defined for a square face, or whether total surface includes the base. If you need a cone from radius and height, a cylinder, or a sphere, use a tool dedicated to those problems; the search intent here is pyramid volume from base and height, with square-base slant and surface when the side is known, and a clear answer or an honest error when height is not positive. Preferred inputs are the scalar height as a JSON number together with one base description: base_area for a general base when you already know the area, side for a square edge length, or the pair length and width for a rectangular base. The response always echoes height, base_area, volume, base_shape, and formula_volume. When the base resolves to a square, it also reports side, slant_height as the square root of h squared plus half-side squared, lateral_surface_area as two times side times that slant, total_surface_area as base plus lateral, and the matching formula strings. Missing height, non-positive height, a missing base, or non-finite values all raise invalid_input with a message that names the failing field. That discipline keeps automated tests stable, makes caching safe, and prevents a script from treating a degenerate solid as a real pyramid.

How the closed forms are evaluated: volume, square slant, and surfaces

The engine requires height to be finite and strictly greater than zero, then resolves the base in a fixed priority order so concurrent fields never produce ambiguous results. For a square side a, slant height is the altitude of a lateral triangular face measured from the midpoint of a base edge up to the apex: the square root of height squared plus half the side squared, which is exactly five when side is six and height is four, a convenient check that mirrors the classic three-four-five pattern after the half-side of three. Lateral surface area multiplies two, the side length, and that slant height, equal to four times the area of one isosceles face triangle with base a and height l. Total surface area adds the square base a squared to the lateral surface. Optional precision only rounds the published fields; the internal solve always uses full double precision before that final rounding step. If side is present, the base is square with base_area equal to side squared. Else if both length and width are present, base_area is their product, and when those two edges are exactly equal the shape is promoted to square so slant and surface formulas still apply. Else base_area must be provided as a positive finite number and the shape is reported as general, which yields volume only. Volume is the exact product of one-third, base_area, and height, independent of any approximation or sampling. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the one-third volume rule or the square-face slant yourself.

Where pyramid metrics fit in study, design, and code

Students meet the pyramid when a textbook asks for volume from base area and height, when an exam demands lateral area given a square side and height, or when solid-geometry homework wants total surface including the base before painting or material estimates. Teachers can pre-generate answer keys that list volume and surfaces for integer sides and heights, and that refuse zero or negative height instead of printing NaN. Architecture and civil design often need the capacity of a pyramidal roof volume, the material area of four triangular faces, or the mass of a monument from known base and height; knowing that a requested height is not positive is as valuable as the number itself. Surveying and CAD workflows place pyramid volumes as construction geometry, and game or simulation teams use volume and surface for collision approximations, particle emitters, and procedural mesh sizing that should stay deterministic across platforms. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split—free interactive exploration and a priced, identical API—matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with other free geometry endpoints when you need cone volume, ellipse metrics, or triangle solvers for a lab of deterministic tools, and with documentation that shows both dimensions and the finished metrics so the numbers and the picture stay aligned for learners and reviewers. Whether you arrived searching for a pyramid volume calculator or for slant height and surface area from a square base and height, the contract is the same: positive height and a valid base in, finite metrics or a clear invalid_input out.

Deterministic geometry fixtures

Generate reproducible pyramid metrics for unit tests, contest validators, and CI assertions without hand-rolled one-third volume or slant-height logic.

What if height is zero or negative?

The handler returns invalid_input with a message that height must be a positive finite number.

How is volume computed?

Volume is always V = (1/3) · base_area · h. Base area comes from side² for a square, length · width for a rectangle, or the base_area field directly.

Can I control rounding?

Yes. Set precision (aliases decimals, dp) to an integer from 0 to 15; the default is 10 decimal places on all numeric fields.

Read the full KIT documentation →