Polygon Diagonals Calculator

Find how many diagonals a polygon has, plus its total interior angles, from the side count.

How it is calculated

The tool reads one input, n, the number of sides of a simple polygon. It must be a whole number from 3 up to 1,000,000,000: a decimal such as 12.7, a value below 3, or a larger one shows no result. It returns two values: the diagonal count D = n(n − 3) / 2 and the interior-angle sum S = (n − 2) × 180, in degrees. The angle sum is for the whole polygon, not for one corner. For a regular polygon you can divide S by n to get each angle; the tool does not do that step. A triangle gives 0 diagonals and 180 degrees, since no two of its vertices are non-adjacent.

Worked example

Take a dodecagon, n = 12. Each vertex can join 12 − 3 = 9 others, so there are 12 × 9 = 108 endpoint pairs; every diagonal is counted from both ends, so 108 / 2 = 54 diagonals. For the angles, (12 − 2) × 180 = 10 × 180 = 1,800 degrees. The tool shows 54 diagonals and an interior-angle sum of 1,800. If the dodecagon is regular, each corner is 1,800 / 12 = 150 degrees.

Try this example →

Common mistakes

  • Typing the number of vertices and the number of sides as different things: they are always equal for a polygon, so a hexagon is 6, not 5 or 7.
  • Expecting the angle result to be one angle. It is the total of all interior angles; divide by the side count yourself for a regular polygon.
  • Entering 2 for a two-sided figure, or a value with decimals. Fewer than 3 sides gives no result, and so does a decimal like 12.7; only whole numbers work.
  • Using the formula on a star or self-intersecting shape. The formulas assume a simple polygon whose sides do not cross.
  • Forgetting the divide-by-two and counting n(n − 3), which counts every diagonal twice.

About this calculator

A diagonal is any line segment connecting two non-adjacent vertices of a polygon. For a polygon with n sides, the number of diagonals is given by the formula n(n − 3)/2 — each of the n vertices can connect to n − 3 others (excluding itself and its two adjacent neighbors), and dividing by 2 corrects for counting each diagonal twice. The sum of a polygon's interior angles follows a separate but related formula, (n − 2) × 180°, which comes from the fact that any n-sided polygon can be split into n − 2 triangles by drawing diagonals from a single vertex.

These formulas are foundational in geometry education and appear constantly in computational geometry, where counting diagonals relates to triangulation algorithms used in computer graphics, mesh generation, and GIS (geographic information systems) for breaking complex polygons into triangles for rendering or area calculation. Architects and structural engineers also reference diagonal counts when analyzing bracing patterns in polygonal trusses and frameworks.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators