Diagonal Calculator

Calculate rectangle diagonal using width and height.

CalcHub

Diagonal Calculator

Full page
Live

Preview

10

Mirrors whichever field is focused below.

Add to workspace

Run up to six calculators on one board. You can try without an account—your board stays on this device until you sign in to save it.

Add to workspace

No account needed—build a local board (one workspace on this device). Sign in later to save it to your account.

Open My workspace →

A diagonal calculator finds the straight-line distance from one corner of a rectangle to the opposite corner when you know the width and height. It is useful for screens, panels, frames, layouts, packaging, and any fit check where the corner-to-corner span matters more than the boundary length. Because the calculation depends on a true right angle, the two inputs must describe perpendicular sides of the same rectangle and must use the same unit. Mixed units can produce a numerically correct but physically wrong answer.

The calculator also helps you sanity-check shape proportions. A valid diagonal should always be longer than either side, and the aspect ratio shows whether the rectangle is narrow or balanced. If the values come from an irregular object, a warped board, or a perspective image, the result should be treated cautiously because the rectangle assumption may not hold.

How This Calculator Works

The rectangle can be split into two right triangles by drawing a line from one corner to the opposite corner. The diagonal is the hypotenuse of that right triangle, so the calculator uses the Pythagorean theorem on width and height. It squares each side, adds the squared values, and then takes the square root to return to the original length unit.

Basic validation should reject negative values because side lengths cannot be negative in this geometry. If the width and height are not in the same unit, convert one measurement before calculating. For example, a width in inches and a height in centimeters should not be combined directly.

Formula

Rectangle diagonal: d = √(w² + h²)

Squared form: d² = w² + h²

Aspect ratio: w / h or expressed as w:h

Variable definitions:

SymbolMeaningUnit rule
wWidth of the rectangleMust match the unit used for h
hHeight of the rectangleMust match the unit used for w
dDiagonal from corner to cornerUses the same unit as the inputs

The aspect ratio does not change the diagonal itself; it describes the proportion between the two sides. If width and height are swapped, the diagonal stays the same, but the ratio changes. That makes ratio a useful cross-check for input entry.

Example Calculation

  1. Start with a rectangle that has width 10 and height 5 in the same unit.
  2. Square each side: 10² = 100 and 5² = 25.
  3. Add the squared values: 100 + 25 = 125.
  4. Take the square root: √125 = 11.1803398875.
  5. Round the result if needed: the diagonal is about 11.1803 units.
  6. Check the aspect ratio: 10 / 5 = 2, so the rectangle has a 2:1 proportion.

This matches the expected result for a rectangle that is twice as wide as it is tall. The diagonal is greater than both 10 and 5, which is the correct geometric behavior.

Where This Calculator Is Commonly Used

  • Screen and display sizing, where the advertised size may refer to the diagonal rather than width.
  • Framing, cabinetry, and woodworking, where clearance and fit often depend on corner-to-corner span.
  • Packaging and shipping, where an item must pass through an opening or fit inside a container by its longest span.
  • Floor plans, panels, tiles, and rectangular construction elements that need quick geometric verification.
  • Graphic layouts, signage, and digital design when a bounding rectangle or artboard must be checked.

How to Interpret the Results

The diagonal should always be at least as long as the longer side of the rectangle. If it is not, the inputs may be invalid, mixed-unit, or entered incorrectly. A diagonal that is only slightly longer than the long side usually means the rectangle is slender. A much larger diagonal relative to a side usually means the rectangle is more balanced.

Use the aspect ratio to understand shape, not size. A 2:1 ratio means one side is twice the other, but it does not tell you the diagonal by itself. For fabrication, transport, or clearance checks, keep as many decimal places as necessary until the final rounding step.

Frequently Asked Questions

Why do I need width and height in the same unit?

The formula assumes both legs of the right triangle are measured on the same scale. If one side is in inches and the other is in centimeters, the squaring step combines incompatible values and the diagonal becomes physically meaningless. Convert one measurement first, then calculate the diagonal.

Can the diagonal be shorter than the width or height?

No. For any valid rectangle with nonzero sides, the diagonal is always longer than either individual side because it spans both perpendicular directions at once. If the result is shorter, check for swapped values, unit mismatch, or an input that does not describe a true rectangle.

Does swapping width and height change the diagonal?

No. The diagonal formula is symmetric, so d = √(w² + h²) gives the same result regardless of which value you call width or height. The aspect ratio changes, though, because width divided by height is not the same as height divided by width.

Is this the same as perimeter?

No. Perimeter measures the distance around the outside edge of a rectangle, while the diagonal is the straight line between opposite corners. Perimeter uses addition of all sides, but diagonal uses the Pythagorean theorem and a square root.

What happens if I enter a negative side length?

Negative side lengths should be rejected because a rectangle’s width and height are physical distances, not directional quantities. A negative input usually indicates a data-entry issue, a sign error, or a value that belongs to a different calculation. Convert it to a valid nonnegative measurement before using the tool.

How precise should the final diagonal be?

Use precision that matches the purpose. For rough planning, a rounded value may be enough. For fabrication, installation, or clearance work, keep several decimal places until the last step so rounding does not introduce a fit problem. The final unit should match the input unit.

FAQ

  • Why do I need width and height in the same unit?

    The formula assumes both legs of the right triangle are measured on the same scale. If one side is in inches and the other is in centimeters, the squaring step combines incompatible values and the diagonal becomes physically meaningless. Convert one measurement first, then calculate the diagonal.

  • Can the diagonal be shorter than the width or height?

    No. For any valid rectangle with nonzero sides, the diagonal is always longer than either individual side because it spans both perpendicular directions at once. If the result is shorter, check for swapped values, unit mismatch, or an input that does not describe a true rectangle.

  • Does swapping width and height change the diagonal?

    No. The diagonal formula is symmetric, so d = √(w² + h²) gives the same result regardless of which value you call width or height. The aspect ratio changes, though, because width divided by height is not the same as height divided by width.

  • Is this the same as perimeter?

    No. Perimeter measures the distance around the outside edge of a rectangle, while the diagonal is the straight line between opposite corners. Perimeter uses addition of all sides, but diagonal uses the Pythagorean theorem and a square root.

  • What happens if I enter a negative side length?

    Negative side lengths should be rejected because a rectangle’s width and height are physical distances, not directional quantities. A negative input usually indicates a data-entry issue, a sign error, or a value that belongs to a different calculation. Convert it to a valid nonnegative measurement before using the tool.

  • How precise should the final diagonal be?

    Use precision that matches the purpose. For rough planning, a rounded value may be enough. For fabrication, installation, or clearance work, keep several decimal places until the last step so rounding does not introduce a fit problem. The final unit should match the input unit.