Diagonal Calculator
Two sides in, one line out: the diagonal of a rectangle is the square root of width squared plus height squared, and a box adds depth squared under the same root. What this page does differently is take the measurements as they were written down. Each field accepts its own unit, so 36 in beside 2 ft is converted to 36 in by 24 in before anything is squared, and the answer comes back in the unit you picked: 43.267 in, with the working printed underneath as the square root of 1872. An answer that is whole is named as exact, so a 3 by 4 rectangle reads 5 exactly and a 1 by 2 by 2 box reads 3 exactly, and a side that has no diagonal (a negative length, a zero, a unit the page does not know) is refused with a sentence saying which. The drawing beside the figure follows the sides you entered and says so when one is too thin to draw in proportion. This is the sides-to-diagonal direction: the screen size page reports the pixels this browser can see and says it cannot know a panel in inches, and the aspect ratio calculator scales one side against another, so neither of them returns a measured diagonal.
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.
Three cases, worked
Every line below is computed by the code that answers the calculator above, so the examples and the tool can never disagree.
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.
- 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 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. Type the unit into the field itself and the page converts before it squares: 36 in beside 2 ft becomes 36 in by 24 in and gives 43.267 in. It reads mm, cm, m, in, ft and yd, their spelled-out names, and the marks for feet and inches. Conversions inside one family use whole-number factors, so 2 ft is exactly 24 in, and the one conversion that crosses families uses the international inch of 25.4 mm. The Answer in control decides which unit everything lands in.
- 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: no browser reports 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, which is where 43.2666153056 becomes 43.267, and the unrounded figure sits beside it in the working line. Nothing is rounded before the answer is worked out. When the shown figure is the whole answer, as with a 3 by 4 rectangle, the page says exactly instead of hiding the difference.
- 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.