GintiCalcEvery calculation

GeomBench

Diagonal Calculator

One page, every shape's diagonal.

Diagonals of squares, rectangles, cubes and polygons

For flat and solid shapes the result is a length. For a polygon it is instead the count of diagonals, which is what the shape's name usually asks about.

ShapeDimensionsDiagonal lengthDiagonal count
Rectangle3 x 45.0000-
Squareside 57.0711-
Cubeside 46.9282-
Rectangle6 x 810.0000-
Hexagon6 sides-9
Octagon8 sides-20

A square's diagonal is always its side times the square root of 2, about 1.4142, and a cube's space diagonal is the side times the square root of 3, about 1.7321 - which is why the 5-unit square gives 7.0711 and the 4-unit cube gives 6.9282. The polygon rows answer a different question entirely: how many diagonals a polygon has, given by n(n-3)/2, which is 9 for a hexagon and 20 for an octagon. A triangle has none, since every pair of vertices is already joined by a side.

Diagonals come from the Pythagorean theorem

A rectangle's diagonal is just the hypotenuse of the right triangle formed by its width and height — √(w² + h²) — and a square or cube diagonal is the same idea extended to equal sides (and a third dimension, for a cube).

Polygons have many diagonals, not one

A regular polygon with n sides has n(n−3)÷2 total diagonals connecting non-adjacent vertices, each a different length depending on how many vertices it skips — this page shows the count and the shortest one.

Frequently asked questions

How do I find the diagonal of a rectangle?

Diagonal = √(length² + width²). A 3×4 rectangle has diagonal √(9+16) = √25 = 5. This is the Pythagorean theorem — the diagonal splits the rectangle into two right triangles.

What is the diagonal of a square?

Diagonal = side × √2 ≈ side × 1.414. A square with side 10 has diagonal 14.14. Conversely, side = diagonal / √2. This comes from the Pythagorean theorem where both legs are equal.

How many diagonals does a polygon have?

Number of diagonals = n(n−3)/2, where n is the number of sides. Triangle: 0, square: 2, pentagon: 5, hexagon: 9, octagon: 20. Each vertex connects to n−3 others (all except itself and its two neighbors), divided by 2 to avoid double-counting.

Related Math calculators

You might also like

Last updated: September 6, 2026