Polygon Diagonals Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/10/2026
The number of diagonals of a convex polygon with n sides is calculated with D = n × (n − 3) ÷ 2. A hexagon (6 sides) therefore has 9 diagonals.
Explanation
A diagonal connects two vertices of a polygon that are not already connected by a side. To count the diagonals, you can reason vertex by vertex: each vertex can connect to n−3 other vertices by a diagonal — you exclude the vertex itself, as well as its two immediate neighbors, already connected to it by a side of the polygon, not a diagonal. Multiplying this number n−3 by the n vertices of the polygon counts each diagonal exactly twice (once from each of its two endpoints), which explains the division by 2 in the final formula D = n(n−3)/2. This formula incidentally confirms an intuitive result: a triangle (n=3) has no diagonals, since all its vertices are already connected pairwise by its three sides — it is the smallest polygon that exists. The number of diagonals grows much faster than the number of sides: a 10-sided polygon already has 35, and a 20-sided polygon has 170, a quadratic growth (proportional to n²) also found in other pair-counting problems, such as the number of possible permutations and combinations in a set of objects. This counting of diagonals is used notably to triangulate a polygon (split it into triangles using non-crossing diagonals), a basic operation in computer graphics and structural analysis, and also indirectly in calculating the area of a regular polygon, which can be decomposed into triangles from its center rather than by its diagonals.
Example: hexagon (6 sides)
Inputs
Number of sides: 6.
Calculation
D = 6 × (6 − 3) ÷ 2 = 6 × 3 ÷ 2 = 18 ÷ 2 = 9.
Result
A hexagon has 9 diagonals.
Frequently asked questions
Why does a triangle have no diagonals?
Because a triangle has only three vertices, and each pair of vertices is already connected by a side of the triangle — so there is no pair of non-adjacent vertices to connect by a diagonal. It is the smallest possible polygon, and the only one where all pairs of vertices are sides.
Does this formula also apply to non-convex polygons (with notches)?
The count of segments connecting non-adjacent vertices stays the same, whether the polygon is convex or not: the formula D = n(n−3)/2 does count all these diagonals. The difference appears only for certain geometric uses of these diagonals (such as triangulation): in a non-convex polygon, some diagonals can pass outside the shape, which never happens in a convex polygon.
How does the number of diagonals grow relative to the number of sides?
It grows quadratically, much faster than the number of sides itself: doubling a polygon's number of sides roughly quadruples its number of diagonals for large polygons, since the formula contains an n² term. A 100-sided polygon thus has 4,850 diagonals, for only 100 sides.