{
  "id": "pyramid-volume",
  "version": "1974d7659446",
  "status": "published",
  "name": "Pyramid Volume Calculator",
  "question": "What is the pyramid volume?",
  "summary": "Finds the volume of a pyramid with a square, rectangular, triangular or regular-polygon base, or a known base area, from V = ⅓ × base area × height.",
  "category": "math",
  "subcategory": "geometry",
  "url": "https://www.acalculator.org/math/pyramid-volume-calculator",
  "markdown": "https://www.acalculator.org/math/pyramid-volume-calculator.md",
  "kind": "function",
  "method": "V = ⅓ × B × h. B = s² (square), l × w (rectangle), ½ × b × t (triangle), n s² ÷ (4 tan(π ÷ n)) (regular n-gon), or the typed base area.",
  "assumptions": [
    "The height is measured at a right angle to the base, so the formula holds for right and oblique pyramids alike.",
    "Lengths are in any one unit; the base area is in that unit squared and the volume in that unit cubed."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "base": {
        "title": "Base shape",
        "description": "The shape of the pyramid’s base.",
        "type": "string",
        "enum": [
          "square",
          "rect",
          "tri",
          "poly",
          "area"
        ]
      },
      "s": {
        "title": "Base side (s)",
        "description": "The length of one side of the square or regular polygon base.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1000000000000
      },
      "n": {
        "title": "Number of sides (n)",
        "description": "How many sides the regular polygon base has: 5 for a pentagon, 6 for a hexagon.",
        "type": "integer",
        "minimum": 3,
        "maximum": 1000
      },
      "l": {
        "title": "Base length (l)",
        "description": "The length of the rectangular base.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1000000000000
      },
      "w": {
        "title": "Base width (w)",
        "description": "The width of the rectangular base.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1000000000000
      },
      "tb": {
        "title": "Triangle base",
        "description": "One side of the triangular base.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1000000000000
      },
      "th": {
        "title": "Triangle height",
        "description": "The height of the triangular base, at a right angle to that side.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1000000000000
      },
      "ba": {
        "title": "Base area (B)",
        "description": "The area of the base, in the length unit squared.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1e+24
      },
      "h": {
        "title": "Height (h)",
        "description": "The distance from the apex straight down to the plane of the base.",
        "type": "number",
        "minimum": 1e-12,
        "maximum": 1000000000000
      }
    }
  },
  "outputs": {
    "volume": {
      "label": "Volume",
      "description": "The space inside the pyramid, in the length unit cubed.",
      "format": "number"
    },
    "baseArea": {
      "label": "Base area",
      "description": "The area of the base, in the length unit squared.",
      "format": "number"
    },
    "prism": {
      "label": "Prism with the same base and height",
      "description": "Base area × height: the pyramid is one third of it.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "base": "square",
      "s": 6,
      "n": 6,
      "l": 4,
      "w": 3,
      "tb": 6,
      "th": 4,
      "ba": 50,
      "h": 4
    },
    "outputs": {
      "volume": 48,
      "baseArea": 36,
      "prism": 144
    },
    "text": "A pyramid with a base area of 36 and a height of 4 has a volume of 48."
  },
  "examples": [
    {
      "given": {
        "base": "square",
        "s": 6,
        "h": 4
      },
      "expect": {
        "volume": 48,
        "baseArea": 36,
        "prism": 144
      },
      "source": "OpenStax, Calculus Volume 1, §6.2 Determining Volumes by Slicing (Example 6.6: a pyramid with a square base of side a and height h has V = ⅓a²h), https://openstax.org/books/calculus-volume-1/pages/6-2-determining-volumes-by-slicing (retrieved 2026-10-05); hand calculation in content.mdx: ⅓ × 6² × 4 = 48"
    },
    {
      "given": {
        "base": "rect",
        "l": 4,
        "w": 3,
        "h": 5
      },
      "expect": {
        "volume": 20,
        "baseArea": 12
      },
      "source": "hand calculation in content.mdx: ⅓ × 4 × 3 × 5 = 20; OpenStax, Calculus Volume 1, §6.2 Determining Volumes by Slicing (Example 6.6: a pyramid with a square base of side a and height h has V = ⅓a²h), https://openstax.org/books/calculus-volume-1/pages/6-2-determining-volumes-by-slicing (retrieved 2026-10-05)"
    },
    {
      "given": {
        "base": "tri",
        "tb": 6,
        "th": 4,
        "h": 10
      },
      "expect": {
        "volume": 40,
        "baseArea": 12
      },
      "source": "hand calculation in content.mdx: B = ½ × 6 × 4 = 12, V = ⅓ × 12 × 10 = 40; OpenStax, Calculus Volume 1, §6.2 Determining Volumes by Slicing (Example 6.6: a pyramid with a square base of side a and height h has V = ⅓a²h), https://openstax.org/books/calculus-volume-1/pages/6-2-determining-volumes-by-slicing (retrieved 2026-10-05)"
    },
    {
      "given": {
        "base": "poly",
        "n": 6,
        "s": 2,
        "h": 3
      },
      "expect": {
        "baseArea": 10.392304845413264,
        "volume": 10.392304845413264
      },
      "source": "hand calculation in content.mdx: B = 6 × 2² ÷ (4 tan 30°) = 6√3, V = ⅓ × 6√3 × 3 = 6√3; OpenStax, Contemporary Mathematics, §10.6 Area (a regular polygon’s area is ½ × apothem × perimeter), https://openstax.org/books/contemporary-mathematics/pages/10-6-area (retrieved 2026-10-05); OpenStax, Calculus Volume 1, §6.2 Determining Volumes by Slicing (Example 6.6: a pyramid with a square base of side a and height h has V = ⅓a²h), https://openstax.org/books/calculus-volume-1/pages/6-2-determining-volumes-by-slicing (retrieved 2026-10-05)",
      "tolerance": 1e-12
    },
    {
      "given": {
        "base": "area",
        "ba": 0.1,
        "h": 0.3
      },
      "expect": {
        "volume": 0.01,
        "prism": 0.03
      },
      "source": "hand calculation in content.mdx: ⅓ × 0.1 × 0.3 = 0.01 exactly"
    }
  ],
  "sources": [
    "OpenStax, Calculus Volume 1, §6.2 Determining Volumes by Slicing (Example 6.6: the volume of a pyramid with a square base, V = ⅓a²h), CC BY-NC-SA 4.0. https://openstax.org/books/calculus-volume-1/pages/6-2-determining-volumes-by-slicing (retrieved 2026-10-05)",
    "OpenStax, Contemporary Mathematics, §10.6 Area (the area of a regular polygon, ½ × apothem × perimeter), CC BY 4.0. https://openstax.org/books/contemporary-mathematics/pages/10-6-area (retrieved 2026-10-05)"
  ],
  "related": [
    "volume",
    "cone-volume",
    "surface-area",
    "rectangular-prism"
  ],
  "changelog": []
}
