Number of polygon diagonals

Type the number of vertices n. The number of diagonals is n(n − 3)/2. A quadrilateral, n = 4, gives 2. A pentagon, n = 5, gives 5. A hexagon, n = 6, gives 9.

The calculator counts how many diagonals there are, not how long they are. n = 3 gives 0, because a triangle has no diagonal. n = 2 gives −1, because that is the formula.

Input data

Results

Enter data and click Calculate.

How it works

From each vertex you can draw n − 3 diagonals, because you skip yourself and the two neighbours. Then you divide by 2, because each edge is counted from both ends. n = 4 gives 4×1/2 = 2. n = 5 gives 5. n = 6 gives 9.

The field is the vertex count n. This is not a diagonal length and not the area of the polygon. A quadrilateral has two diagonals. A pentagon has five. A hexagon has nine.

n = 3, a triangle, gives 0. n = 2 gives −1. The calculator does not lock the drawing, it only multiplies n(n − 3)/2. A fractional n, for example 4.5, also passes and is not a side count on paper.

The sum of polygon angles is on the neighbouring page and takes the same n, but computes degrees, not strokes. Here you always stay with the number of diagonals.

The header units switch does not multiply anything. 5 stays 5 whatever the label says.

n = 4 gives 2. n = 5 gives 5. n = 6 gives 9. That is the whole card: one n and the inner strokes. Diagonals need the vertices count.

Formula

d = n(n − 3)/2

How to use

  1. Type the number of vertices, for example 5.
  2. Click Calculate. The number of diagonals is 5.
  3. n = 4 gives 2. n = 6 gives 9.
  4. n = 3 gives 0. A triangle has no diagonal.
  5. The angle sum from the same n lives on the neighbouring card.

n = 5 gives 5

The number of diagonals is n(n − 3)/2. n = 4 gives 2. n = 5 gives 5. n = 6 gives 9.

diagonals
Inner segments, not sides. A quadrilateral has 2. A pentagon has 5. A hexagon has 9.
vertices
Field n. 4 gives 2. 3 gives 0, because a triangle has no diagonal.
polygon
A figure with n sides. Here you count strokes, not the angle sum.

Examples

Example 1

  • n = 4

2

How many diagonals does a quadrilateral have? 2. n(n − 3)/2 at n = 4.

Example 2

  • n = 5

5

How many diagonals does a pentagon have? 5.

Example 3

  • n = 6

9

How many diagonals does a hexagon have? 9.

Related calculators

Common questions

How many diagonals does a quadrilateral have?

2. 4×(4 − 3)/2 = 2.

What does the number of diagonals mean?

How many segments join vertices without being a side. Formula n(n − 3)/2.

What about a pentagon and a hexagon?

5 and 9.

What about a triangle?

0. n = 3, n − 3 = 0.

Is this a diagonal length?

No. Counts only. Length would need sides, not n.

What about n = 2?

−1. The formula does not stop. On paper that is not a polygon.

Does n have to be an integer?

School wants an integer. The calculator will also multiply 4.5.

How is this different from the angle sum?

Strokes here. There (n − 2)×180°. Another result from the same n.

Why divide by 2?

Each diagonal is counted from both ends. Without /2 you would double it.

Does a comma in 6.0 work?

Yes. 6 and 6.0 give 9.

Knowledge sources

The calculator computes the same formula as the definition below.

Page updated in 2026.