Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Number of Diagonals
5
diagonals in a 5-sided polygon
Number of sides (n) 5
Triangles from one vertex (n − 2) 3

What Is a Polygon Diagonal?

A diagonal of a polygon is a straight line segment that connects two non-adjacent vertices (corners). Sides of the polygon are not diagonals because they join neighbouring vertices. This calculator tells you exactly how many diagonals any polygon has, from a triangle up to a thousand-sided shape, using the standard combinatorial formula.

Pentagon with all five diagonals drawn between non-adjacent vertices
A pentagon's diagonals connect non-adjacent vertices, while sides connect adjacent ones.

How to Use the Calculator

Enter the number of sides n of your polygon (which equals the number of vertices) and the calculator returns the total number of diagonals. The number of sides must be 3 or greater, since a triangle is the smallest polygon. Note that a triangle has zero diagonals — all of its vertices are adjacent.

The Formula Explained

The formula is $$D = \frac{n(n - 3)}{2}$$. Each of the n vertices can connect to \(n - 3\) others to form a diagonal: you subtract itself and its two neighbouring vertices. That gives \(n(n - 3)\) endpoints, but every diagonal is counted twice (once from each end), so you divide by 2.

Advertisement
Single vertex of a hexagon connecting to non-adjacent vertices, illustrating n minus 3 diagonals
From each vertex you can draw n−3 diagonals, since the vertex itself and its two neighbors are excluded.

Worked Example

For a pentagon, \(n = 5\). Then $$D = \frac{5 \times (5 - 3)}{2} = \frac{5 \times 2}{2} = 5.$$ A pentagon therefore has 5 diagonals. For a hexagon, \(n = 6\): $$D = \frac{6 \times 3}{2} = 9 \text{ diagonals.}$$ For a square, \(n = 4\): $$D = \frac{4 \times 1}{2} = 2 \text{ diagonals (the two crossing lines).}$$

FAQ

Does this work for any polygon? Yes — it works for both convex and concave polygons, since the count of diagonals depends only on the number of vertices, not their positions.

Why does a triangle have no diagonals? All three vertices of a triangle are adjacent to each other, so there are no non-adjacent pairs to connect. The formula confirms this: \(\frac{3 \times (3 - 3)}{2} = 0\).

How many diagonals does a 100-gon have? $$D = \frac{100 \times 97}{2} = 4{,}850 \text{ diagonals.}$$

Last updated: