Try this
Drag any vertex of the rectangle below. It will remain a rectangle and the length of the diagonal will be calculated.

A rectangle has two diagonals. Each one is a
line segment
drawn between the opposite
vertices (corners) of the rectangle.
The diagonals have the following properties:

The two diagonals are
congruent (same length).
In the figure above, click 'show both diagonals',
then drag the orange dot at any vertex of the rectangle and convince yourself this is so.

Each diagonal
bisects
the other. In other words, the point where the diagonals
intersect (cross),
divides each diagonal into two equal parts

Each diagonal divides the rectangle into two
congruent right triangles.
Because the triangles are congruent, they have the same area, and each triangle has half the area of the rectangle

Length of the diagonal

In the figure above, click 'reset'. As you can see, a diagonal of a rectangle divides it into two
right triangles,
BCD and DAB.
The diagonal of the rectangle is the
hypotenuse
of these triangles.
We can use
Pythagoras' Theorem
to find the length of the diagonal if we know the width and height of the rectangle.

As a formula:

where: w is the width of the rectangle h is the height of the rectangle

Use the calculator on the right to calculate the properties of a rectangle.

Enter the two side lengths and the rest will be calculated.
For example, enter the two side lengths. The area, perimeter and diagonal lengths will be found.

Things to try

In the figure at the top of the page, click on 'reset' and 'hide details'.
Then drag the corners to create an arbitrary rectangle.
Calculate the length of the diagonals.
Click 'show details' to verify your answer.

A rectangle has a height of 12 and a diagonal of 31.
Find the width of the rectangle and use the animation or the calculator above to verify your answer.