Logo

MonoCalc

/

Polygon Diagonal Count

Geometry

Quick presets

Number of sides (n)

A Hexagon (n = 6) has:

9

diagonals

D(n) = n Ɨ (n āˆ’ 3) / 2

D(6) = 6 Ɨ (6 āˆ’ 3) / 2 = 6 Ɨ 3 / 2 = 9

Comparison

6-gon

9

diagonals

7-gon

14

diagonals

Increase

+5

diagonals

Polygon Diagram

123456

Side

Diagonal

Diagonal Sequence (n = 3 to 6)

Sides (n)NameDiagonals D(n)
3Triangle0
4Quadrilateral2
5Pentagon5
6Hexagon9

About This Tool

Polygon Diagonal Count Calculator – How Many Diagonals Does a Polygon Have?

A diagonal of a polygon is a line segment that connects two non-adjacent vertices. Unlike sides, which connect neighboring vertices, diagonals cut through the interior of the shape. Counting diagonals is a classic combinatorics problem with a clean, closed-form solution that applies to any convex polygon.

The Diagonal Count Formula

For a polygon with n sides (and therefore n vertices), the total number of diagonals is:

D(n) = n Ɨ (n āˆ’ 3) / 2

The formula is derived from combinatorics. There are C(n, 2) = n(n āˆ’ 1) / 2 ways to choose any two vertices and draw a line segment between them. Of these, exactly n segments are sides of the polygon (connecting adjacent vertices). Subtracting the sides gives:

D(n) = n(n āˆ’ 1)/2 āˆ’ n = n(n āˆ’ 3)/2

Results for Common Polygons

Applying the formula to the most commonly encountered shapes produces a rapidly growing sequence:

  • Triangle (n = 3): D = 3 Ɨ 0 / 2 = 0 diagonals
  • Quadrilateral (n = 4): D = 4 Ɨ 1 / 2 = 2 diagonals
  • Pentagon (n = 5): D = 5 Ɨ 2 / 2 = 5 diagonals
  • Hexagon (n = 6): D = 6 Ɨ 3 / 2 = 9 diagonals
  • Octagon (n = 8): D = 8 Ɨ 5 / 2 = 20 diagonals
  • Decagon (n = 10): D = 10 Ɨ 7 / 2 = 35 diagonals
  • Dodecagon (n = 12): D = 12 Ɨ 9 / 2 = 54 diagonals

Notice that diagonals grow roughly as n² / 2 — adding one more side always increases the diagonal count by n āˆ’ 2. This quadratic growth means a 20-sided polygon has 170 diagonals and a 100-sided polygon has 4,850.

Why Does a Triangle Have Zero Diagonals?

In a triangle, every vertex is adjacent to both of the other vertices. There are no non-adjacent pairs, so there are no diagonals. Plugging n = 3 into the formula gives 3 Ɨ (3 āˆ’ 3) / 2 = 0, confirming this geometrically obvious result.

Practical Applications

Structural Engineering

Engineers use cross-bracing in trusses, bridges, and building frames to add rigidity. Each brace corresponds to a diagonal of the polygon formed by the structural nodes. Knowing how many diagonals a frame has helps estimate material requirements for cross-bracing plans.

Network Design

In a fully-connected network (where every node communicates directly with every other node), the number of links equals C(n, 2) = n(n āˆ’ 1)/2. If you arrange the nodes as polygon vertices, the diagonals plus the n sides give you the total link count. This is useful in mesh networking, social graph analysis, and telecommunications topology design.

Combinatorics and Discrete Mathematics

The diagonal count appears in graph theory as the number of edges in a complete graph Kn minus the n edges of the cycle Cn. It also underlies problems involving polygon triangulation, where a convex n-gon can be divided into exactly n āˆ’ 2 triangles using n āˆ’ 3 non-crossing diagonals.

Puzzle and Game Design

Puzzles that involve connecting dots, logic grids, or polygonal paths often rely on counting diagonals. Game boards shaped as regular polygons use diagonal counts to determine movement options, line-of-sight rules, or the number of possible straight-line paths.

Regular vs. Irregular Polygons

The formula D = n(n āˆ’ 3)/2 depends only on the number of vertices, not on the specific shape of the polygon. Whether you have a perfectly regular hexagon or a wildly irregular one with six sides of different lengths, the diagonal count is the same: nine. The only assumption is that no three vertices are collinear (which would make a diagonal coincide with a side or degenerate to a point).

Using This Calculator

Enter any integer from 3 to 1,000 in the input field, or tap one of the preset buttons for common shapes. The calculator instantly shows:

  • The total diagonal count with a step-by-step arithmetic breakdown
  • An interactive SVG diagram of the polygon with all diagonals drawn
  • A comparison between n sides and n + 1 sides to illustrate how quickly the count grows
  • A scrollable sequence table from the triangle up to your entered n (capped at 50 rows)

Use the Copy Result button to copy the diagonal count as a plain integer, or Export CSV to download the full sequence table for use in spreadsheets or reports.

Frequently Asked Questions

Is the Polygon Diagonal Count free?

Yes, Polygon Diagonal Count is totally free :)

Can I use the Polygon Diagonal Count offline?

Yes, you can install the webapp as PWA.

Is it safe to use Polygon Diagonal Count?

Yes, any data related to Polygon Diagonal Count only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is a diagonal of a polygon?

A diagonal is a line segment that connects two non-adjacent vertices of a polygon. Unlike the sides, which connect adjacent vertices, diagonals cut across the interior of the polygon. A triangle has no diagonals because every pair of its vertices is already connected by a side.

How is the number of diagonals in a polygon calculated?

The formula is D = n(n āˆ’ 3) / 2, where n is the number of sides (equal to the number of vertices). It comes from combinatorics: there are C(n, 2) = n(n āˆ’ 1)/2 total line segments between any two vertices, and subtracting the n sides gives n(n āˆ’ 1)/2 āˆ’ n = n(n āˆ’ 3)/2.

How many diagonals does a hexagon have?

A hexagon (n = 6) has D = 6 Ɨ (6 āˆ’ 3) / 2 = 6 Ɨ 3 / 2 = 9 diagonals. You can verify this visually: from each vertex, 3 diagonals can be drawn (to the 3 non-adjacent vertices), giving 6 Ɨ 3 = 18, but each diagonal is shared by 2 vertices, so 18 / 2 = 9.

Why does a triangle have zero diagonals?

In a triangle (n = 3), every vertex is adjacent to both other vertices, so there are no non-adjacent vertex pairs to connect. Substituting n = 3 into the formula confirms this: D = 3 Ɨ (3 āˆ’ 3) / 2 = 3 Ɨ 0 / 2 = 0.

How do diagonals relate to network connections?

In a fully-connected network where each node connects to every other node, the number of connections equals the number of diagonals plus the number of sides of the polygon formed by the nodes. For n nodes, the total connections is C(n, 2) = n(n āˆ’ 1)/2, which is exactly the diagonals formula plus n.

Does the formula work for irregular polygons too?

Yes. The formula D = n(n āˆ’ 3)/2 depends only on the count of vertices, not on the lengths of the sides or the internal angles. It works equally for regular polygons (all sides equal) and irregular ones, as long as no three vertices are collinear (which would make some diagonals coincide with sides).