Diagonal Calculator

All free toolsGeometry Calculators
Geometry CalculatorsFree online tool

Diagonal Calculator

Calculate rectangle, square and cuboid diagonals.

The diagonal is calculated using the Pythagorean theorem in 2D or 3D.

Free online tool by SOCE. Check inputs and results before using them for important decisions.

Diagonal Calculator – Free Online Diagonal Length Formulas and Examples

The SOCE Diagonal Calculator page provides a mathematical guide to finding diagonal lengths in rectangles, squares, cuboids, and other geometric shapes using standard geometry formulas.

A diagonal is a line segment connecting two nonadjacent vertices of a polygon or polyhedron. Diagonal measurements are important in mathematics, civil engineering, architecture, construction, surveying, and computer-aided design.

For rectangles and squares, diagonal length can be calculated using the Pythagorean theorem. For a cuboid, the space diagonal depends on three perpendicular dimensions.

This Diagonal Calculator guide explains diagonal formulas, worked examples, inverse calculations, units, and practical engineering applications.

What Is a Diagonal Calculator?

A Diagonal Calculator is a mathematical tool used to determine diagonal lengths from known geometric dimensions.

Common diagonal calculations include:

  • Rectangle diagonal length.
  • Square diagonal length.
  • Cuboid face diagonal.
  • Cuboid space diagonal.
  • Missing rectangle dimensions.
  • Diagonal length using the Pythagorean theorem.
  • Number of diagonals in a polygon.

Different shapes require different formulas.

For example, consider a rectangle with:

Length = 8 cm

Width = 6 cm

Diagonal:

d = √(8² + 6²)

d = √100

Diagonal = 10 cm

Understanding Diagonals in Geometry

What Is a Diagonal?

In a polygon, a diagonal is a straight line segment connecting two nonadjacent vertices.

In a three-dimensional polyhedron, diagonals may lie on faces or pass through the interior of the solid.

Face Diagonal

A face diagonal connects two opposite vertices of a rectangular face.

For a rectangle:

d = √(l² + w²)

Space Diagonal

A space diagonal connects opposite vertices of a cuboid through its interior.

For a cuboid:

D = √(l² + w² + h²)

Diagonal vs Side Length

A side is part of the boundary of a polygon.

A diagonal connects nonadjacent vertices.

In a non-degenerate rectangle, the diagonal is longer than either side.

Diagonal Calculator Formulas

Shape or calculation Formula
Rectangle diagonal d = √(l² + w²)
Square diagonal d = a√2
Cuboid space diagonal D = √(l² + w² + h²)
Cube space diagonal D = a√3
Rectangle length from diagonal l = √(d² − w²)
Rectangle width from diagonal w = √(d² − l²)
Square side from diagonal a = d/√2
Rectangle diagonal from area and one side d = √[l² + (A/l)²]
Polygon diagonal count N = n(n − 3)/2
Regular polygon long diagonals Depends on number of sides and circumradius

Where:

  • d = two-dimensional diagonal length.
  • D = three-dimensional space diagonal.
  • l = rectangle or cuboid length.
  • w = width.
  • h = height.
  • a = square or cube side.
  • A = rectangle area.
  • n = number of polygon vertices.

The formulas must be applied to the correct geometry.

Rectangle Diagonal Calculator

A rectangle has four right angles and two pairs of equal opposite sides.

Its diagonal divides the rectangle into two right triangles.

Rectangle Diagonal Formula

Using the Pythagorean theorem:

d² = l² + w²

Therefore:

d = √(l² + w²)

Worked Example

Length = 12 cm

Width = 5 cm

Diagonal:

d = √(12² + 5²)

d = √(144 + 25)

d = √169

Answer = 13 cm

Rectangle Diagonal from Length and Height

In many practical applications, the two perpendicular dimensions are called width and height.

The formula remains:

d = √(w² + h²)

Square Diagonal Calculator

A square has four equal sides and four right angles.

Its diagonal divides the square into two congruent right triangles.

Square Diagonal Formula

For side length a:

d² = a² + a²

d² = 2a²

Therefore:

d = a√2

Worked Example

Square side = 10 cm

d = 10√2

Answer ≈ 14.14 cm

Finding Square Side from Diagonal

Rearranging:

a = d/√2

Worked Example

Diagonal = 10√2 cm

a = 10√2/√2

Answer = 10 cm

Square Area from Diagonal

Square area:

A = a²

Since a = d/√2:

A = d²/2

Therefore:

A = d²/2

For diagonal 10 cm:

Area = 50 cm²

Cuboid Diagonal Calculator

A cuboid, also called a rectangular prism, has three mutually perpendicular dimensions.

It has face diagonals and space diagonals.

Cuboid Face Diagonal

For a face with dimensions l and w:

d = √(l² + w²)

Cuboid Space Diagonal

For a cuboid with length l, width w, and height h:

D = √(l² + w² + h²)

Worked Example

Length = 3 cm

Width = 4 cm

Height = 12 cm

Space diagonal:

D = √(3² + 4² + 12²)

D = √(9 + 16 + 144)

D = √169

Answer = 13 cm

Why Does the Formula Work?

First calculate the base diagonal:

d² = l² + w²

Then use the base diagonal and vertical height to form another right triangle:

D² = d² + h²

Substituting:

D² = l² + w² + h²

Therefore:

D = √(l² + w² + h²)

Cube Diagonal Calculator

A cube is a special cuboid with equal length, width, and height.

Let each edge be a.

Cube Face Diagonal

d = a√2

Cube Space Diagonal

D = a√3

Worked Example

Cube edge = 6 cm

Face diagonal:

d = 6√2

Face diagonal ≈ 8.49 cm

Space diagonal:

D = 6√3

Space diagonal ≈ 10.39 cm

The face diagonal and space diagonal are different geometric measurements.

Diagonal Calculator Using the Pythagorean Theorem

The Pythagorean theorem states that for a right triangle:

c² = a² + b²

Where c is the hypotenuse.

Therefore:

c = √(a² + b²)

A rectangle diagonal is the hypotenuse of a right triangle formed by the rectangle’s length and width.

Worked Example

Perpendicular dimensions:

a = 9 m

b = 12 m

Diagonal:

c = √(9² + 12²)

c = √225

Answer = 15 m

This is useful for geometric layout and distance calculations.

Finding Rectangle Length from Diagonal

If diagonal d and width w are known:

d² = l² + w²

Rearranging:

l² = d² − w²

Therefore:

l = √(d² − w²)

Worked Example

Diagonal = 13 cm

Width = 5 cm

Length:

l = √(13² − 5²)

l = √144

Answer = 12 cm

For a non-degenerate rectangle, the diagonal must be longer than the width.

Finding Rectangle Width from Diagonal

If diagonal d and length l are known:

w = √(d² − l²)

Worked Example

Diagonal = 10 cm

Length = 8 cm

Width:

w = √(10² − 8²)

w = √36

Answer = 6 cm

Diagonal from Rectangle Area

If rectangle area A and length l are known:

A = lw

Therefore:

w = A/l

Substituting into the diagonal formula:

d = √[l² + (A/l)²]

Worked Example

Area = 60 cm²

Length = 12 cm

Width:

w = 60/12 = 5 cm

Diagonal:

d = √(12² + 5²)

Answer = 13 cm

Number of Diagonals in a Polygon

A polygon with n vertices has:

N = n(n − 3)/2

diagonals.

This counts the distinct line segments connecting nonadjacent vertices.

Why Does the Formula Work?

From each vertex, diagonals can connect to n − 3 vertices.

The excluded vertices are:

  • The starting vertex itself.
  • The two adjacent vertices.

This gives n(n − 3) connections when counted from every vertex.

Each diagonal is counted twice, so divide by two.

Worked Examples

Polygon Number of sides Number of diagonals
Triangle 3 0
Quadrilateral 4 2
Pentagon 5 5
Hexagon 6 9
Heptagon 7 14
Octagon 8 20
Decagon 10 35

The formula counts diagonals, not their lengths.

Diagonals of a Regular Polygon

A regular polygon has equal side lengths and equal interior angles.

Unlike a rectangle, a regular polygon with many vertices can have diagonals of different lengths.

For a regular n-sided polygon with circumradius R, the chord joining vertices separated by k edges has length:

dₖ = 2R sin(kπ/n)

Where:

  • R = circumradius.
  • n = number of sides.
  • k = number of edges separating the chosen vertices along the polygon.
  • 2 ≤ k ≤ floor(n/2) for diagonals of distinct lengths.

For a regular pentagon, all five diagonals have the same length.

For a regular hexagon, there are diagonals of different lengths.

Diagonal vs Diameter

A diagonal is a segment connecting nonadjacent vertices of a polygon or polyhedron.

A diameter is a line segment passing through the centre of a circle or sphere with endpoints on its boundary.

For a square inscribed in a circle, the square diagonal equals the circle diameter.

However, diagonals and diameters are not generally interchangeable measurements.

Diagonal vs Perimeter

Diagonal length measures the straight-line distance between specified vertices.

Perimeter measures the total boundary length of a two-dimensional polygon.

For a rectangle:

Perimeter:

P = 2(l + w)

Diagonal:

d = √(l² + w²)

These measurements describe different geometric properties.

Diagonal Unit Conversion

Diagonal length is a linear measurement.

Common units include:

  • Millimetres (mm).
  • Centimetres (cm).
  • Metres (m).
  • Inches (in).
  • Feet (ft).

Important Conversion Factors

1 m = 100 cm

1 cm = 10 mm

1 in = 2.54 cm exactly

1 ft = 12 in exactly

1 ft = 0.3048 m exactly

Worked Example

A rectangle measures:

Length = 3 m

Width = 4 m

Diagonal:

d = √(3² + 4²)

d = 5 m

Convert to centimetres:

5 × 100 = 500 cm

Answer = 5 m = 500 cm

Important Note

All input dimensions must use the same length unit before applying the diagonal formula.

Diagonal Calculator for Civil Engineering

Diagonal measurements are important in civil engineering, architecture, construction layout, surveying, and structural modelling.

Rectangular Building Layout

A rectangular building footprint can be checked using its diagonal measurements.

For a rectangle with length L and width B:

d = √(L² + B²)

Worked Example

Building length = 12 m

Building width = 9 m

Expected diagonal:

d = √(12² + 9²)

Answer = 15 m

If a layout is intended to be rectangular, its measured diagonals can be compared with the theoretical diagonal.

Equal diagonals alone do not establish that an arbitrary quadrilateral is a rectangle. Additional geometric constraints are required.

Rectangular Foundation Layout

Diagonal measurements help check geometric dimensions during foundation setting-out.

Actual site tolerances must follow project specifications.

Structural Bracing

For an ideal rectangular frame with horizontal span L and vertical height H, a diagonal brace between opposite corners has geometric centreline length:

d = √(L² + H²)

Worked Example

Frame span = 6 m

Frame height = 4 m

Brace diagonal:

d = √(6² + 4²)

Answer ≈ 7.21 m

Actual brace fabrication length depends on connection geometry, offsets, and detailing.

Floor and Slab Geometry

Diagonal measurements can help verify rectangular floor or slab layouts.

CAD and 3D Modelling

The distance between two points in three-dimensional Cartesian coordinates is:

D = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]

This is a general distance formula based on the three-dimensional Pythagorean relationship.

Surveying and Coordinate Geometry

For two points in a two-dimensional Cartesian coordinate system:

d = √[(x₂ − x₁)² + (y₂ − y₁)²]

This formula is useful for coordinate-based geometric distance calculations.

Common Mistakes in Diagonal Calculations

  1. Adding length and width directly instead of using the Pythagorean theorem.
  2. Forgetting to square the perpendicular dimensions.
  3. Confusing face diagonal with space diagonal.
  4. Using two-dimensional formulas for three-dimensional distances.
  5. Mixing measurement units.
  6. Confusing diagonal length with polygon diagonal count.
  7. Using an invalid diagonal shorter than a known rectangle side.
  8. Assuming every quadrilateral has the same diagonal properties as a rectangle.
  9. Using geometric centreline lengths as fabrication lengths without considering connections.
  10. Rounding intermediate calculations too early.

Frequently Asked Questions About Diagonal Calculator

1. What is a Diagonal Calculator?

A Diagonal Calculator is a mathematical tool used to determine diagonal lengths in geometric shapes from known dimensions.

2. What is the rectangle diagonal formula?

d = √(l² + w²).

3. What is the square diagonal formula?

d = a√2.

4. What is the cuboid space diagonal formula?

D = √(l² + w² + h²).

5. What is the cube space diagonal formula?

D = a√3.

6. How do you calculate a diagonal using the Pythagorean theorem?

Square the two perpendicular side lengths, add them, and take the square root.

7. How do you find rectangle length from its diagonal?

l = √(d² − w²).

8. How do you find rectangle width from its diagonal?

w = √(d² − l²).

9. How do you find square side length from its diagonal?

a = d/√2.

10. What is the difference between face diagonal and space diagonal?

A face diagonal lies on a face of a solid. A space diagonal passes through the interior between opposite vertices.

11. How many diagonals does a polygon have?

An n-sided polygon has n(n − 3)/2 diagonals.

12. How many diagonals does a rectangle have?

A rectangle has two diagonals.

13. Are the diagonals of a rectangle equal?

Yes. The two diagonals of a rectangle have equal lengths.

14. Are the diagonals of a square perpendicular?

Yes. The diagonals of a square are equal in length and perpendicular to each other.

15. Can diagonal measurements help in construction layout?

Yes. They are useful for checking rectangular geometry, but additional layout constraints and tolerances must also be considered.

16. Why is diagonal geometry important in engineering?

Diagonal measurements are useful in construction setting-out, structural bracing, CAD, surveying, and geometric verification.

Explore Diagonal Geometry with SOCE

The SOCE Diagonal Calculator page provides a mathematical reference for understanding diagonal length, geometric distance, and the Pythagorean theorem.

Use this Diagonal Calculator guide to study rectangle diagonals, square diagonals, cuboid space diagonals, inverse dimension calculations, and polygon diagonal counts.

Explore additional mathematics and engineering resources through the SOCE Geometry Calculators collection.