Shapes & spaces

Regular polygon diagonal count calculator

Count all segments between nonadjacent vertices, counting each pair once.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Each vertex reaches n−3 nonadjacent vertices. Dividing by two removes the double count from the two endpoints.

THE FORMULAn(n−3)/2

A worked example

An octagon has 8 × 5 ÷ 2 = 20 diagonals.

Good to know

The same count applies to any simple polygon with n distinct vertices.

Count nonadjacent vertex pairs exactly once

From each vertex of an n-sided polygon, exclude the vertex itself and its two neighbours. That leaves n − 3 diagonal endpoints. Multiplying by n counts every diagonal twice, once from each end, so the total is n(n − 3)/2.

For an octagon, this gives 8 × 5/2 = 20 diagonals. The SVG highlights the five diagonals from one chosen vertex. Repeating that count at all eight vertices gives forty endpoint counts, which must be divided by two.

Five diagonals leave one selected vertex of an octagonn − 3 = 5From one vertexTotal = 20
The five highlighted segments leave a chosen vertex. Eight vertices count each diagonal twice, giving 8 × 5 / 2 = 20.

Distinguish diagonal counts from intersections and regions

Another derivation starts with all unordered vertex pairs, n(n − 1)/2, and subtracts the n sides. This again leaves n(n − 3)/2. A triangle has zero diagonals, a quadrilateral two and a pentagon five. Adding one vertex increases the total by n − 1 when n denotes the previous vertex count.

The formula counts segments joining nonadjacent vertices. It does not count crossing points or the regions those segments create. For a concave polygon, some counted diagonals can lie partly outside its interior. Equal sides and angles are unnecessary for this combinatorial count. The Regular polygon sides from interior angle calculator requires regularity because it infers n from one angle. Enter a whole number of at least three distinct vertices, and keep the intended polygon boundary fixed when deciding which vertices are adjacent.

A few questions, answered

Does a diameter count as a diagonal?

If it joins nonadjacent vertices, yes. In an even-sided regular polygon, opposite-vertex diameters are included.

Does the size of the polygon matter?

No. Scaling or distorting the polygon preserves the number of nonadjacent vertex pairs.

Find your calculator

Start typing to explore the library.