{
  "id": "octagon",
  "version": "bfd81d1d794b",
  "status": "published",
  "name": "Octagon Calculator",
  "question": "What is the octagon’s area?",
  "summary": "Finds every measure of a regular octagon from any one of them: side, perimeter, area, apothem, circumradius, width and the long and short diagonals.",
  "category": "math",
  "subcategory": "geometry",
  "url": "https://www.acalculator.org/math/octagon-calculator",
  "markdown": "https://www.acalculator.org/math/octagon-calculator.md",
  "kind": "formulas",
  "method": "P = 8s; apothem = s(1 + √2) ÷ 2; A = ½ × apothem × P = 2(1 + √2)s²; R = s√(4 + 2√2) ÷ 2; width = s(1 + √2); long diagonal = s√(4 + 2√2); short diagonal = s√(2 + √2).",
  "assumptions": [
    "The octagon is regular: eight equal sides and eight equal angles of 135°.",
    "Type one measure; the side follows from it, and every other measure from the side."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "s": {
        "title": "Side (s)",
        "description": "The length of one side of the regular octagon.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 1000000000
      },
      "p": {
        "title": "Perimeter (P)",
        "description": "The distance around the octagon: eight sides.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 8000000000
      },
      "a": {
        "title": "Area (A)",
        "description": "The space inside the octagon: half the apothem times the perimeter.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "area",
        "exclusiveMinimum": 0,
        "maximum": 5000000000000000000
      },
      "ap": {
        "title": "Apothem (inradius)",
        "description": "The distance from the center to the middle of a side, at a right angle to the side.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 2000000000
      },
      "r": {
        "title": "Circumradius (R)",
        "description": "The distance from the center to a corner.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 2000000000
      },
      "w": {
        "title": "Width across flats",
        "description": "The distance between two opposite sides: twice the apothem, also the middle diagonal.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 3000000000
      },
      "d": {
        "title": "Long diagonal (D)",
        "description": "The distance between opposite corners, through the center.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 3000000000
      },
      "ds": {
        "title": "Short diagonal",
        "description": "The distance between two corners with one corner between them.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "length",
        "exclusiveMinimum": 0,
        "maximum": 2000000000
      }
    }
  },
  "solve": {
    "fillAny": 1,
    "variables": [
      "s",
      "p",
      "a",
      "ap",
      "r",
      "w",
      "d",
      "ds"
    ],
    "inputsOnly": []
  },
  "outputs": {
    "s": {
      "label": "Side (s)",
      "description": "The length of one side of the regular octagon.",
      "format": "quantity"
    },
    "p": {
      "label": "Perimeter (P)",
      "description": "The distance around the octagon: eight sides.",
      "format": "quantity"
    },
    "a": {
      "label": "Area (A)",
      "description": "The space inside the octagon: half the apothem times the perimeter.",
      "format": "quantity",
      "unit": "in2"
    },
    "ap": {
      "label": "Apothem (inradius)",
      "description": "The distance from the center to the middle of a side, at a right angle to the side.",
      "format": "quantity"
    },
    "r": {
      "label": "Circumradius (R)",
      "description": "The distance from the center to a corner.",
      "format": "quantity"
    },
    "w": {
      "label": "Width across flats",
      "description": "The distance between two opposite sides: twice the apothem, also the middle diagonal.",
      "format": "quantity"
    },
    "d": {
      "label": "Long diagonal (D)",
      "description": "The distance between opposite corners, through the center.",
      "format": "quantity"
    },
    "ds": {
      "label": "Short diagonal",
      "description": "The distance between two corners with one corner between them.",
      "format": "quantity"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "s": 0.127
    },
    "outputs": {
      "p": 1.016,
      "a": 0.0778777010950313,
      "ap": 0.15330256121069152,
      "r": 0.16593349653929984,
      "w": 0.30660512242138305,
      "d": 0.3318669930785997,
      "ds": 0.23466540125786683
    },
    "text": "A regular octagon with side 5 in has an area of 120.711 in² and a perimeter of 40 in."
  },
  "examples": [
    {
      "given": {
        "s": 5
      },
      "expect": {
        "p": 40,
        "ap": 6.035533905932738,
        "a": 120.71067811865476,
        "r": 6.532814824381883,
        "w": 12.071067811865476,
        "d": 13.065629648763766,
        "ds": 9.238795325112868
      },
      "source": "OpenStax, Contemporary Mathematics, §10.6 Area (regular polygon A = ½ap, with a the apothem and p the perimeter). https://openstax.org/books/contemporary-mathematics/pages/10-6-area; hand calculation in content.mdx: apothem 5(1 + √2) ÷ 2 = 6.0355, A = ½ × 6.0355 × 40 = 50(1 + √2)"
    },
    {
      "given": {
        "p": 16
      },
      "expect": {
        "s": 2,
        "a": 19.31370849898476,
        "w": 4.82842712474619
      },
      "source": "hand calculation in content.mdx: s = 16 ÷ 8 = 2, A = 2(1 + √2) × 4 = 19.3137; OpenStax, Contemporary Mathematics, §10.4 Polygons, Perimeter, and Circumference (P = n·s; the angles of an n-gon add to (n − 2) × 180°). https://openstax.org/books/contemporary-mathematics/pages/10-4-polygons-perimeter-and-circumference; OpenStax, Contemporary Mathematics, §10.6 Area (regular polygon A = ½ap, with a the apothem and p the perimeter). https://openstax.org/books/contemporary-mathematics/pages/10-6-area"
    },
    {
      "given": {
        "a": 100
      },
      "expect": {
        "s": 4.550898605622273,
        "p": 36.40718884497819
      },
      "source": "hand calculation in content.mdx: s = √(100 ÷ (2(1 + √2))) = 4.5509; OpenStax, Contemporary Mathematics, §10.6 Area (regular polygon A = ½ap, with a the apothem and p the perimeter). https://openstax.org/books/contemporary-mathematics/pages/10-6-area"
    },
    {
      "given": {
        "w": 10
      },
      "expect": {
        "s": 4.14213562373095,
        "ap": 5
      },
      "source": "hand calculation in content.mdx: s = 10 ÷ (1 + √2) = 10(√2 − 1) = 4.1421; OpenStax, Contemporary Mathematics, §10.4 Polygons, Perimeter, and Circumference (P = n·s; the angles of an n-gon add to (n − 2) × 180°). https://openstax.org/books/contemporary-mathematics/pages/10-4-polygons-perimeter-and-circumference"
    }
  ],
  "sources": [
    "OpenStax, Contemporary Mathematics, §10.6 Area (A = ½ap for a regular polygon, with a the apothem and p the perimeter). https://openstax.org/books/contemporary-mathematics/pages/10-6-area (retrieved 2026-10-05)",
    "OpenStax, Contemporary Mathematics, §10.4 Polygons, Perimeter, and Circumference (P = n·s; the angles of an n-sided polygon add to (n − 2) × 180°). https://openstax.org/books/contemporary-mathematics/pages/10-4-polygons-perimeter-and-circumference (retrieved 2026-10-05)"
  ],
  "related": [
    "hexagon",
    "area",
    "perimeter"
  ],
  "changelog": []
}
