---
slug: polygon-diagonal-calculator
title: "Polygon Diagonal Calculator"
category: geometry
updated: 2026-11-17
canonical: https://calcseed.com/c/geometry/polygon-diagonal-calculator/
html: /c/geometry/polygon-diagonal-calculator/
---

# Polygon Diagonal Calculator

Calculate the number of diagonals in any polygon from its number of sides using D = n(n−3)/2. Free and instant.

## Quick answer

**Quick answer:** with the default inputs (6), the diagonals is **9**. Change any input to update the result.

## Default calculation

Values computed by this calculator at exactly the default inputs listed below.

### Inputs (defaults)

| Input | Value | Unit |
| --- | --- | --- |
| Number of sides | 6 |  |

### Outputs at these defaults

| Output | Value | Unit |
| --- | --- | --- |
| Diagonals | 9 |  |

## Formula

```text
D = n(n − 3) ÷ 2
```

```text
D = n(n − 3) ÷ 2
```

## Inputs

| Variable | Type | Unit | Default |
| --- | --- | --- | --- |
| Number of sides | number |  | 6 |

## Outputs

| Result | Format |
| --- | --- |
| Diagonals | primary |
| Diagonals | number |

## How it works

### What counts as a diagonal

A **diagonal** joins two vertices that are not already connected by a side. Enter the number of sides n and the calculator returns how many diagonals the polygon has. The count is purely combinatorial — it depends only on how many vertices there are, not on the polygon&rsquo;s shape, size, or regularity, so a scraggly concave 7-gon and a perfect heptagon both have exactly 14.

### The formula and where it comes from

Stand at one vertex: you can draw a segment to every other vertex except yourself and your two neighbors, so each vertex launches n − 3 diagonals. Across n vertices that suggests n(n − 3) segments — but every diagonal has two ends and has just been counted once from each, so the true total is half that.

A second derivation cross-checks it: all segments joining pairs of vertices number n(n − 1) ÷ 2, and n of those are the sides, leaving (n(n − 1) ÷ 2) − n = n(n − 3) ÷ 2 diagonals. Both routes agree, and the second one shows why the answer is always a whole number: among n(n − 3), either n or n − 3 is even.

### Worked example with the default hexagon

The calculator loads with n = 6. Each hexagon vertex connects by diagonal to 6 − 3 = 3 others (skipping itself and two neighbors), and 6 × 3 ÷ 2 = **9 diagonals**. You can picture them: three long diagonals through the centre connecting opposite vertices, and six shorter ones linking every second vertex around the rim. The cross-check route gives the same figure: 6 × 5 ÷ 2 = 15 total segments, minus 6 sides, equals 9 diagonals.

### Diagonal counts by polygon

| Polygon | Sides | Diagonals |
| --- | --- | --- |
| Triangle | 3 | 0 |
| Quadrilateral | 4 | 2 |
| Pentagon | 5 | 5 |
| Hexagon | 6 | 9 |
| Heptagon | 7 | 14 |
| Octagon | 8 | 20 |
| Nonagon | 9 | 27 |
| Decagon | 10 | 35 |
| Dodecagon | 12 | 54 |
| Icosagon | 20 | 170 |

A triangle has no diagonals because every vertex is adjacent to both of the others. From there the count grows roughly with the square of n — each added side brings a batch of new diagonals three larger than the last batch: +2, +3, +4, +5 and so on down the table. A 100-sided polygon has 4,850 diagonals — about 48 for every side it has.

The pentagon row hides a famous pattern: its 5 diagonals trace the pentagram, and each diagonal measures exactly &phi; ≈ 1.618 times the side length, linking this count to the golden ratio. The hexagon&rsquo;s 9 diagonals split into 3 long ones through the centre and 6 short rim-to-rim ones, and every high-sided polygon shows the same kind of internal structure worth sketching once to believe.

### What the diagonal count is used for

#### Diagonals as the triangulation skeleton

Diagonals are the skeleton of polygon work. Drawing all diagonals from a single vertex splits an n-gon into n − 2 triangles, which is where the interior-angle sum (n − 2) × 180 degrees comes from — the hexagon&rsquo;s four diagonals from one vertex produce the four triangles behind its 720-degree total. In surveying and mesh generation, diagonals define the triangulation patterns that turn any polygon into computable pieces.

#### The same count outside geometry

The same counting logic appears far from geometry. A round-robin tournament where every player meets every other player runs n(n − 1) ÷ 2 games — the all-pairs count — and a knockout structure planning only non-adjacent pairings uses the diagonal count directly. Network designers face the identical number when deciding how many cross-connections a ring of n nodes can take before it stops being a simple ring.

### What moves the number

- Side count is the only input: shape, size, and symmetry have no effect on how many diagonals exist.
- Growth is quadratic — doubling n from 6 to 12 raises the count from 9 to 54, six times rather than two.
- Each new side adds n − 2 diagonals when going from an (n−1)-gon to an n-gon, so additions accelerate.
- The formula reads n(n − 3) ÷ 2, not n(n − 1) ÷ 2, which is the all-pairs count including sides.
- Concave polygons can have diagonals outside the boundary, but they still count — the formula never subtracts them.

### Common mistakes

- Forgetting the division by 2, which double-counts every diagonal and reports 18 for a hexagon instead of 9.
- Using n − 2 instead of n − 3 per vertex, which wrongly treats the two neighbors as valid diagonal targets.
- Reporting the interior-angle formula (n − 2) × 180 ÷ n as a diagonal count — the two formulas share the (n − 2) idea but measure different things.
- Assuming a concave polygon has fewer diagonals because some fall outside; they are still diagonals.
- Applying the formula to a polygon with collinear or repeated vertices, where the vertex model itself breaks down.

## FAQ

### How many diagonals does a hexagon have?

Nine: D = 6 × (6 − 3) ÷ 2 = 9. Three run through the centre between opposite vertices and six link every second vertex.

### Why does a triangle have zero diagonals?

Every vertex is adjacent to both of the others, so there is no pair of non-adjacent vertices to connect. The formula confirms it: 3 × 0 ÷ 2 = 0.

### What is the formula for diagonals?

D = n(n − 3) ÷ 2, where n is the number of sides. A decagon gives 10 × 7 ÷ 2 = 35.

### How many diagonals does a 12-sided polygon have?

12 × 9 ÷ 2 = 54. Doubling the hexagon&rsquo;s sides multiplies its diagonal count by six.

### Why is the count divided by 2?

Counting from every vertex counts each diagonal twice, once from each endpoint, so the raw n(n − 3) must be halved.

### Does the shape or size of the polygon matter?

No. The count depends only on the number of vertices, so any quadrilateral has 2 diagonals and any heptagon has 14, regular or not.

### How many diagonals from a single vertex?

Exactly n − 3, since the vertex connects by diagonal to every vertex except itself and its two neighbors. A hexagon offers 4 diagonals from each vertex.

### How are diagonals related to the interior angle sum?

Drawing the n − 3 diagonals from one vertex splits the polygon into n − 2 triangles, giving the angle sum (n − 2) × 180 degrees — 720 for a hexagon.

### How many diagonals does a 100-sided polygon have?

100 × 97 ÷ 2 = 4,850. Quadratic growth is why high-sided polygons contain far more diagonals than sides.

### Do diagonals that fall outside a concave polygon count?

Yes. The definition only requires non-adjacent vertices; a diagonal lying partly outside the boundary is still one of the n(n − 3) ÷ 2.

## Method and sources

Methodology: Formulas are the standard closed-form expressions of Euclidean geometry, exact for the given inputs.

Last updated: 2026-11-17.
- Number of diagonals of an n-gon: D = n(n−3)/2.
