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.
| Shape | Dimensions | Diagonal length | Diagonal count |
|---|---|---|---|
| Rectangle | 3 x 4 | 5.0000 | - |
| Square | side 5 | 7.0711 | - |
| Cube | side 4 | 6.9282 | - |
| Rectangle | 6 x 8 | 10.0000 | - |
| Hexagon | 6 sides | - | 9 |
| Octagon | 8 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
Inradius Calculator
Inradius of a triangle (from its 3 sides) or a regular polygon.
OpenCircumradius Calculator
Circumradius of a triangle (from its 3 sides) or a regular polygon.
OpenCentroid Calculator
Centroid (center of mass) of a triangle from its 3 vertices.
OpenParallelogram Area Calculator
Area, height, and perimeter of a parallelogram from base, side, and angle.
OpenYou might also like
Freezing Point Depression Calculator
ScienceHow much a dissolved solute lowers a solution's freezing point.
OpenRadioactive Decay Calculator
ScienceRemaining amount of a radioactive substance after a given time, from its half-life.
OpenCarbon Footprint Calculator
ScienceMonthly CO₂ footprint from electricity use, car travel, and flights.
OpenLast updated: September 6, 2026