Skip to main content
CalcMax

Rectangle Calculator

Range: 0 cm – 1,000,000,000 cm

Range: 0 cm – 1,000,000,000 cm

Result

12.0000 cm²

Area

Perimeter
14.0000 cm
Diagonal
5.0000 cm

A rectangle calculator takes the length and the width of a rectangle and returns three measurements of it: the area, the perimeter and the diagonal. Nothing on this page will surprise anyone who has been through school, and that is rather the point — the rectangle is where the three different kinds of measurement that this whole family of pages deals in can be told apart most clearly, because all three take the same two inputs and all three behave differently when those inputs change. The area is the length times the width, and it answers the question of how much surface the rectangle covers. The perimeter is twice the length plus the width, and it answers how much edge it has, which is the question you are asking when you buy a frame or a strip of edging. The diagonal is the square root of the length squared plus the width squared, and it answers how far it is from one corner to the opposite one, which is the question you are asking when you check whether something will fit through a doorway or across a room. The first two of those are schoolroom formulas. The third is the Pythagorean theorem, and it is worth noticing that it is doing the work here: the diagonal cuts the rectangle into two right triangles, the length and the width are the two legs, and the diagonal is the hypotenuse, which is why the answer is the square root of a sum of squares rather than anything simpler. If you already know two sides of a right triangle you already know how to do this page, and if you do not, the Pythagorean theorem page next door is where that is spelled out on its own.

Common rectangles, from a 4 by 3 to a flat one

Length (cm)Width (cm)Area (cm²)Perimeter (cm)Diagonal (cm)
4312145
5525207.0711
6424207.2111
125603413
10101004014.1421
100505000300111.8034
00000
700147

Eight rectangles, and the first row is the one the page loads with. The column to read carefully is the perimeter, because it repeats: the first row and the last row both come to 14, and the second and third rows both come to 20. That is not an arithmetic slip in the table, it is the fact that a perimeter does not pin down a shape — the 5 by 5 and the 6 by 4 have the same amount of edge and quite different areas and diagonals, which is why the page asks for two numbers rather than one. The fourth row is the 5-12-13 rectangle, the only one here whose three outputs are all whole numbers, and the one to keep alongside 4 by 3 as a second check. The fifth row is a 10 by 10 square, where the diagonal is 14.1421 — a square root that never ends, and the correct answer for a square of that size. The sixth row is deliberately large, to show the area running away from the other two: at 100 by 50 the area is 5000 but the perimeter is only 300 and the diagonal 111.8, because area goes with the square of the size and the other two go with the size itself. The last row is a rectangle flattened to no width, where the area is 0 and the perimeter is still 14. Every number here is recomputed from its length and width when the page is built, in centimetres, and the four decimals are the same four decimals the results panel uses.

Formula

A = l × w P = 2(l + w) d = √(l² + w²)

Length
The longer of the two sides, in centimetres. The page does not check that it is the longer one — swapping the two boxes gives exactly the same three answers, because every formula here treats length and width the same way
Width
The other side, in centimetres, at right angles to the length. Together with the length it fixes the rectangle completely: two independent numbers is what a rectangle needs, where a square needs one and a triangle needs three
Area
The surface the rectangle covers, in square centimetres, which is the length times the width. It is the only one of the three outputs that grows with the square of the size rather than with the size — double both sides and the area goes up four times
Perimeter
The distance all the way around, in centimetres: twice the length plus the width, once for each of the two pairs of sides. It is the measurement you want for anything that runs along the edge, and the one that tells you the least about the shape, since many different rectangles share a perimeter
Diagonal
The straight-line distance from one corner to the opposite one, in centimetres. It is the hypotenuse of the right triangle formed by the length and the width, and it is always the longest straight line that fits inside the rectangle
l² + w²
The sum of the two squares, taken before the square root rather than after. This is the Pythagorean theorem in the form the rectangle uses it, and it is the reason the diagonal is a little longer than the length but never as long as the length plus the width
Four decimal places
How wide every output is written. The area and the perimeter are exact whenever the two inputs are, but the diagonal almost never is: it is a square root, so it usually carries a string of digits and four places is a display width rather than a claim about precision

The three outputs answer three different practical questions about the same object, and knowing which one you want is most of the work. Flooring, paint, turf and fabric are bought by area, so that is the column to read when the rectangle is a surface. Skirting, edging, framing, fencing and trim are bought by length, so that is the perimeter — and it is worth knowing that the perimeter alone cannot tell you the shape, so a room of 4 by 3 and a strip of 7 by 0 have the same amount of skirting, which is true and useless in equal measure. The diagonal comes up when the rectangle is being fitted through or into something: a door opening, a picture frame being squared, a screen quoted by its diagonal rather than its sides, or the longest straight object that will lie flat in a box. It is also the quickest way to check that a rectangle is actually square — measure the two diagonals of anything that is supposed to be rectangular and if they match, the corners are 90 degrees, which is a trick carpenters use on rooms and picture framers use on mounts.

Worked examples

  1. A 4 by 3 rectangle

    1. Area: 4 × 3 = 12
    2. Perimeter: 2 × (4 + 3) = 14
    3. Diagonal: √(4² + 3²) = √(16 + 9) = √25 = 5

    The input the page loads with, and the one rectangle whose three answers are all small whole numbers. It is the 3-4-5 triangle folded in half by its hypotenuse, which is why it comes out clean: the diagonal of this rectangle is one of the oldest integer right triangles there is. If you only ever check one row of this page by hand, check this one — every step is arithmetic you can do without a calculator.

  2. A square, 5 by 5

    1. Area: 5 × 5 = 25
    2. Perimeter: 2 × (5 + 5) = 20
    3. Diagonal: √(5² + 5²) = √50 = 7.0710678…, which rounds to 7.0711

    A rectangle whose sides happen to be equal, which is a square but does not need a different page: put the same number in both boxes and the three formulas give the right answers. The diagonal is 5√2, and it is a square root that never ends — which is why the square calculator next door prints the same 7.0711 for a side of 5. Two pages, one number, and it is the same number on purpose.

  3. A 6 by 4 rectangle

    1. Area: 6 × 4 = 24
    2. Perimeter: 2 × (6 + 4) = 20
    3. Diagonal: √(36 + 16) = √52 = 7.2111025…, which rounds to 7.2111

    The row to hold against the one above it: this rectangle is longer and thinner than the 5 by 5, it covers slightly less ground — 24 against 25 — and it has exactly the same perimeter of 20, but its diagonal is 7.2111 against 7.0711. Same amount of edge, different shape, and the diagonal is the output that notices. That is the whole reason a perimeter on its own is a weak description of a rectangle.

  4. The 5-12-13 rectangle

    1. Area: 12 × 5 = 60
    2. Perimeter: 2 × (12 + 5) = 34
    3. Diagonal: √(144 + 25) = √169 = 13

    The other integer right triangle on this page, and a bigger one. A 5-12-13 rectangle is worth remembering as a second check alongside 3-4-5, because it is large enough that a scaling mistake shows up: a rectangle of 12 by 5 metres is a plausible room, and its diagonal of exactly 13 metres is a measurement you can check with a tape rather than a formula.

  5. A rectangle with no width

    1. Area: 7 × 0 = 0
    2. Perimeter: 2 × (7 + 0) = 14
    3. Diagonal: √(49 + 0) = 7

    A width of zero is allowed, and the three outputs it gives are all correct and all mean something different. The rectangle has been squashed flat into a line segment: it covers no area, so the area is 0; it has no diagonal to speak of, so the diagonal collapses onto the length itself at 7; and the perimeter is still 2 × 7 = 14, which is the distance all the way along the segment and back again, twice. A perimeter for a shape with no area looks like a mistake and is not one.

Limitations

The page is for rectangles only: four sides, four right angles, opposite sides equal. A parallelogram that is not a rectangle has the same two-in-three-out shape but a different diagonal, and the parallelogram page next door is where that is handled. The outputs are in centimetres and square centimetres whatever unit the dropdown is set to, so a length entered in inches comes back as a centimetre answer you have to convert yourself. Four decimal places is a display width rather than a claim about precision: the area and the perimeter are exact whenever the inputs are, but the diagonal is a square root and its last two digits are not meaningful unless the inputs were exact to begin with. The page does not check which of the two inputs is longer, and it does not need to — every formula here is symmetric in the length and the width, so swapping them gives the same three answers and no warning. A width of zero is accepted and produces a real, if degenerate, set of answers; the page does not treat it as an empty box. Nothing here handles a rectangle with rounded corners, a rectangle drawn on a curved surface, or the thickness of a rectangular board or beam, which is a third dimension this page has no field for.

Frequently asked questions

Does it matter which side I put in the length box?
No. Every formula on this page treats the length and the width the same way — the area multiplies them, the perimeter adds them, and the diagonal squares and adds them — so swapping the two boxes gives exactly the same three answers. The page does not check which is longer, and it does not need to. If you find it easier to keep them straight by always putting the longer number first, that is a habit rather than a requirement.
Why is the diagonal longer than the length but shorter than the length plus the width?
Because it is the hypotenuse of the right triangle the diagonal cuts off, so it is the square root of the length squared plus the width squared. Squaring then adding then taking the root always gives something between the two: bigger than either side on its own, because you have added something positive before taking the root, and smaller than the sum of the two, because the square of a sum is bigger than the sum of the squares. The gap between the diagonal and the length plus the width is what you save by cutting across rather than going around.
The perimeter comes out the same for two different rectangles. Is that a bug?
No, and the table is arranged to show it happening twice: 4 by 3 and 7 by 0 both have a perimeter of 14, and 5 by 5 and 6 by 4 both have a perimeter of 20. A perimeter fixes how much edge a rectangle has but not its shape — many different rectangles share one perimeter, and they have different areas and different diagonals. If you need to describe a rectangle completely you need two numbers, which is exactly why the page takes two.
Can I use this to check whether a corner is square?
Yes, and it is the oldest trick there is. Measure both diagonals of the thing you are checking. If they are equal, the four corners are right angles and you have a rectangle; if they are not, you have a parallelogram or a shape with a bent corner, and the longer diagonal is on the side of the obtuse angle. For a large room it is easier to compare two measured diagonals than to try to measure a 90 degree angle, which is why builders do it this way.
Why does a width of zero give a perimeter of 14 instead of nothing?
Because a flat rectangle is still a shape, just a degenerate one. Squashing it to zero width turns it into a line segment of length 7, which covers no area, so the area is 0 and the diagonal collapses onto the length. The perimeter formula does not care: twice the length plus the width is twice 7, which is the distance along the segment and back, once for each of the two long sides that are now on top of each other. The answer is real, and the page treats zero as an input rather than as an empty box.
How is this different from the square calculator?
A square is a rectangle whose sides are equal, so everything here works on a square — put the same number in both boxes and the three answers are right. The difference is the direction of the question. This page takes two numbers and gives answers; the square page takes any one of the side, the perimeter or the area and works out the rest, because a square has only one degree of freedom and a rectangle has two. Use this page when you know both sides, and the square page when you know one measurement and want the others.

References

Related calculators