How this calculation works
Each vertex reaches n−3 nonadjacent vertices. Dividing by two removes the double count from the two endpoints.
n(n−3)/2A 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.
Reference: OpenStax Algebra and Trigonometry, Trigonometric Applications (opens in a new tab) ↗
Read the result
Count all segments between nonadjacent vertices, counting each pair once.
The primary result is labeled “Diagonals”. Keep the input definitions in view when comparing this result with another method.
Try a related calculation
The same count applies to any simple polygon with n distinct vertices.
For a related exercise, try the circle calculator.
A few questions, answered
How can I check the default inputs by hand?
An octagon has 8 × 5 ÷ 2 = 20 diagonals.
Which rule does this calculator apply?
n(n−3)/2