Diagonal Calculator
Enter width and height to find a rectangle diagonal, or choose Box and add depth for a space diagonal. For a square, enter the same length in Width and Height; for a cube, use that length in all three fields. Each side can carry its own unit, and Answer in controls the result. The drawing, converted sides and working update as you type. Imperial answers also show feet plus inches. Rectangle shows area in the square of the answer unit, the diagonal angle to each side and the coordinates where its two diagonals meet.
The straight line from one corner of a rectangle to the opposite corner: the square root of width squared plus height squared. Sides can be typed in different units, and each is converted into the answer unit before it is squared.
Origin: lower-left corner (0, 0); x along Width, y along Height. The diagonals meet at (Width/2, Height/2).
Three cases, worked
Compare a rectangle, a box and a rectangle with mixed units. Each example includes its diagonal.
Common questions
- How do you calculate the diagonal of a rectangle?
- Square the width, square the height, add them, and take the square root. For 36 in by 24 in that is 1296 plus 576, which is 1872, and the square root of 1872 is 43.2666153056, shown as 43.267 in. The page prints that line of arithmetic under the answer with your own numbers in it, so a figure typed into the wrong field is easy to spot.
- How do I find the diagonal of a square or a cube?
- For a square, choose Rectangle and enter the same side length in Width and Height. The formula becomes side × √2: a 10 cm square gives 14.142 cm. For a cube, choose Box and enter 10 cm in Width, Height and Depth; side × √3 gives 17.321 cm. These are diagonal lengths, not areas.
- How do I find a square diagonal and its area in square feet?
- Choose Rectangle, enter the same square side length in Width and Height, and choose ft under Answer in. Width 3 ft and Height 3 ft give a diagonal of 4.2426 ft and a Rectangle area of 9 ft² (square feet). For any rectangle, area is Width × Height after both sides are converted to the answer unit: 36 in by 2 ft gives 6 ft² with Answer in set to ft. Copy includes the current area and diagonal. Selecting cm gives cm², and the other measured units are squared in the same way. With no unit selected, area is in square units with no physical unit. Area uses up to twelve significant figures from double precision arithmetic; it shows a message if the positive product overflows or rounds to zero, while a usable diagonal remains available. Box mode does not show rectangle area.
- What is the space diagonal of a box?
- It is the same square root with one more term: width squared plus height squared plus depth squared. A 1 by 2 by 2 box has a space diagonal of 3 exactly, and a 2 by 3 by 6 box gives 7 exactly. Switch the mode to Box and a Depth field appears. A box 24 by 18 by 12 in has a Width-by-Height face diagonal of 30 in and a space diagonal of 32.311 in, and both are shown, because the depth closes a right triangle on the face diagonal rather than on either side.
- Can I mix units, like inches and feet?
- Yes. Enter 36 in in Width and 2 ft in Height, then choose in under Answer in; the converted sides are 36 in and 24 in and the diagonal is 43.267 in. Each field accepts one number with mm, cm, m, in, ft or yd, their spelled-out names, or feet/inch marks. A combined entry such as 5 ft 6 in is not accepted. Use 5.5 ft or 66 in instead. One foot is 12 inches, and one inch is 25.4 mm.
- Can I see the diagonal in feet and inches?
- Yes. Choose in, ft or yd under Answer in and the extra Feet + inches readout splits the diagonal into whole feet and inches, rounded to the nearest 0.01 in. A 3 ft by 4 ft rectangle shows 5 ft 0 in. If rounded inches reach 12, they carry into the next foot. Copy includes this readout with the working. This rounds the computed diagonal, not the precision of the measurements. At very large magnitudes the extra readout is omitted if the total inches or whole-foot count cannot be split reliably; use the selected-unit result instead. Each input still accepts one number and one unit, such as 5.5 ft or 66 in.
- How do I calculate the angle of a rectangle diagonal?
- Enter the rectangle Width and Height. The Rectangle diagonal angle readout gives the angle in degrees to Width and to Height, and Copy includes both. Width 3 and Height 4 give 53.13° to Width and 36.87° to Height. The angles add to 90°. Box mode shows diagonal lengths rather than these rectangle angles.
- How do I calculate where a rectangle's diagonals intersect?
- Choose Rectangle, enter Width and Height, and select the answer unit. The Rectangle diagonal intersection (x, y) readout gives (Width/2, Height/2) after converting both sides to that unit. The origin is the lower-left corner (0, 0), with x along Width and y along Height. Width 3 and Height 4 give (1.5, 2) with no unit; 36 in and 2 ft with Answer in set to in give (18, 12) in. Copy includes the coordinates, unit and origin. Coordinates use up to twelve significant figures; a midpoint below the numeric range shows a message instead of zero. This calculates the intersection of the two rectangle diagonals; general segment or nonrectangular intersections need other geometry, and Box mode does not show these coordinates.
- Can this calculate the diagonal of a right angle triangle?
- A triangle has no polygon diagonal, but if you mean the hypotenuse of a right triangle, choose Rectangle and enter its two perpendicular legs in Width and Height. Legs of 3 and 4 give a hypotenuse of 5. The displayed rectangle diagonal is that same distance. Other triangles need their own geometry; arbitrary side lengths do not establish a right angle.
- Can I calculate a rectangular plan diagonal or a rise/run distance?
- For positive perpendicular rise and run lengths, enter one in Width and the other in Height in Rectangle mode. The same calculation gives the corner-to-corner distance of a rectangular plan. This is a geometric length calculation; it does not calculate brace cut angles, loads, board quantities or structural design.
- Can I calculate a diagonal brace or gate brace length and direction?
- For the straight distance between two intended endpoints, measure their positive horizontal and vertical separation. Choose Rectangle, enter the horizontal separation in Width and the vertical separation in Height, and choose the answer unit. The diagonal gives the endpoint-to-endpoint length; the Rectangle diagonal angle gives its direction to each axis. For a gate brace with endpoints separated by 3 ft horizontally and 4 ft vertically, the length is 5 ft, with direction 53.13° to Width and 36.87° to Height. These are line directions, not saw cut angles. Joint allowances, cut geometry and strength are outside this result.
- Is the space diagonal the longest thing that fits inside a box?
- For a line with no thickness, yes: the space diagonal is the longest straight segment that fits between two corners of a rectangular box. A real object has width as well as length, so it needs more room than the bare figure suggests, and a box with a lid, a lip or packing inside has less room than its outside measurements say.
- I know the diagonal and the aspect ratio. How do I get the width and the height?
- That is the reverse of this page, and it is one division rather than one root: the diagonal divided by the square root of the ratio terms squared and added, then multiplied by each term. A 16:9 panel sold as 27 in works out at about 23.533 in by 13.237 in, and typing those two figures back into this page reads 27 in. The PPI calculator does that reverse trip from a resolution and a diagonal, and the aspect ratio calculator scales one side against the other.
- Does this measure a TV or a monitor?
- It turns a measured panel into the number screens are sold by. Measure the picture area, not the bezel, and a panel of 47.937 in by 26.964 in reads 55 in. It cannot read your own display: a browser does not reliably report the physical size of a panel, which is why the screen size page gives pixels and says it cannot know the inches.
- Can I use it for pixels, with no unit at all?
- Set Answer in to no unit and the figures stay plain numbers. A 1920 by 1080 frame has a diagonal of 2202.9 pixels, which is the number a pixel density calculation divides by. With no unit chosen, a unit typed into a field is refused rather than guessed at, so the page never mixes a measured length with a count.
- What is the diagonal of an A4 sheet of paper?
- A4 is 210 by 297 mm, so the diagonal is the square root of 132309, which is 363.74 mm. Type the same sheet as 210 mm and 297 mm with the answer unit set to in and it reads 14.321 in, because each side is converted before it is squared rather than the answer being converted afterwards.
- What happens if I enter a negative length or a zero?
- Both are refused, and each says which field and why: a length cannot be negative, and a side of zero leaves no rectangle to measure. A unit the page does not know is named back to you with the list of the ones it does know, and a paste that is not a number is quoted back rather than read as a zero.
- Why does the answer show five figures?
- The headline is rounded to five significant figures: 43.2666153056 appears as 43.267. The working uses up to twelve significant figures, so it is also a formatted value. Arithmetic uses double precision. The word exactly means the headline equals the computed number without additional display rounding, as in the 3 by 4 rectangle giving 5; it does not certify measurement precision.
- Are my measurements sent anywhere?
- They stay in this browser. The last sides you typed are remembered locally so the page opens where you left it, and nothing is uploaded. If storage is blocked or full the calculator still works, it simply forgets.
Exact geometry: a rectangle's diagonal is the square root of width squared plus height squared, and a box's space diagonal adds depth squared under the same root. Every length is converted into one unit before it is squared, and that unit is printed with the answer. Negative lengths are refused.