Skip to content
Popular Calculators
Browse Math calculators

Rectangle Calculator

Find a rectangle's area, perimeter and diagonal from its sides — or work backwards from the area, perimeter or diagonal to a missing side.

What do you want to work out?

About the Rectangle Calculator

The rectangle is the shape most of the built world is made of. Rooms, windows, sheets of plywood, screens, tiles, garden beds, paving slabs, patches of lawn. Its formulas are the first geometry anyone learns and the ones most used decades afterwards.

There are only three numbers worth knowing about a rectangle beyond its two sides — the area, the perimeter and the diagonal — and this calculator works in every direction between them. Give it both sides and it returns all three. Give it one side plus the area, the perimeter or the diagonal, and it recovers the side you are missing first.

That reverse direction is the useful one in practice. You rarely know both dimensions and want the area; more often you know the area you need and one dimension you are stuck with.

How to Use the Rectangle Calculator

Choose your starting point:

Both sides. The straightforward case.

The area and one side. For "I need 40 square metres and the frontage is 8 metres — how deep?"

The perimeter and one side. For "I have 26 metres of fencing and one side must be 8 metres."

The diagonal and one side. For "the screen is 13 inches corner to corner and 5 inches tall."

Press Calculate. Which side you call the length makes no difference to any result.

The Three Formulas

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

  Rearranged:
  w = A / l                 from the area
  w = P/2 - l               from the perimeter
  w = √(d² - l²)            from the diagonal

The perimeter rearrangement is the one people get wrong. It is not P − l. Half the perimeter is one length plus one width, so you halve first and then subtract. A perimeter of 26 gives 13 to share, and a length of 8 leaves a width of 5 — not 18.

The diagonal formula is Pythagoras: the diagonal cuts the rectangle into two right triangles whose legs are the sides.

Area and Perimeter Are Not Related

This surprises people, and it matters for anything involving material and boundary at once.

A fixed perimeter does not fix the area. Every one of these has a perimeter of 26:

| Sides | Perimeter | Area | |-------|-----------|------| | 1 × 12 | 26 | 12 | | 3 × 10 | 26 | 30 | | 5 × 8 | 26 | 40 | | 6 × 7 | 26 | 42 | | 6.5 × 6.5 | 26 | 42.25 |

The area ranges from 12 to 42.25 — more than threefold — with the same length of fence. And the pattern is consistent: for a fixed perimeter the area is largest when the shape is closest to a square, and it falls away as the rectangle gets thinner.

This is a genuinely useful fact. Fencing a paddock with a fixed length of wire? Make it as square as the site allows. Sizing a room to a fixed wall length? A square room gives the most floor for the same amount of wall — which is also why it is the cheapest shape to build and to heat, since the perimeter is what loses heat.

The reverse holds too: for a fixed area, the square has the smallest perimeter. A long thin room needs more wall, more skirting and more heating than a square one of the same floor area.

Step-by-Step Example

Both sides. A room 4.2 by 3.6 metres.

  A = 4.2 × 3.6 = 15.12 m²
  P = 2(4.2 + 3.6) = 2 × 7.8 = 15.6 m
  d = √(4.2² + 3.6²) = √(17.64 + 12.96) = √30.6 ≈ 5.532 m

So 15.12 m² of flooring, 15.6 m of skirting less the doorway, and the longest thing you can carry in flat is about 5.5 m.

From the area. A shop needs 40 m² of floor and the frontage is fixed at 8 m.

  depth = 40 / 8 = 5 m

From the perimeter. 26 metres of edging, one side fixed at 8 metres.

  l + w = 26 / 2 = 13
  w = 13 - 8 = 5 m
  area = 8 × 5 = 40 m²

From the diagonal. A 13-inch screen that is 5 inches tall.

  width = √(13² - 5²) = √(169 - 25) = √144 = 12 inches

Which is why screen sizes alone tell you so little — a 13-inch 4:3 screen and a 13-inch widescreen have noticeably different areas.

Understanding Your Result

The area is in square units. Metres in, square metres out.

The sides are echoed back so you can check the recovered one.

The perimeter is the distance all the way round — what fencing, edging, skirting and trim are measured in.

The diagonal is corner to corner. Both diagonals of a rectangle are equal and they bisect each other, which makes the diagonal a practical tool rather than a curiosity: if the two diagonals of a frame measure the same, the corners are square. Builders and cabinetmakers use this constantly, because it checks the whole shape at once rather than one corner at a time.

The shape line says whether you have a square and, if not, how many times longer the rectangle is than it is wide.

When Should You Use This Calculator?

Flooring, tiling and carpet. Area gives the quantity; add the usual allowance for cuts and waste on top.

Paint. Wall area is the height times the width, and the perimeter times the height gives all four walls of a room at once.

Fencing and edging. Perimeter, not area.

Turf and topsoil. Area for coverage, and depth turns it into a volume.

Checking a frame for square. Measure both diagonals; equal means true.

Screens and monitors. Sold by diagonal, so the sides have to be recovered from it and the aspect ratio.

Sheet materials. How many pieces fit a sheet depends on both dimensions, not just the area — a fact area alone will mislead you about.

Land and plots. Frontage and depth, with area for the price per square metre.

Common Mistakes

Subtracting the side from the whole perimeter. Halve first. P/2 − l, never P − l.

Adding lengths to get an area. 4 m plus 3 m is 7 m, not 12 m². Area comes from multiplication, and the units say so: metres times metres is square metres.

Mixing units mid-calculation. Centimetres against metres gives an answer wrong by a factor of 100 — or 10,000 once it is squared. Convert first.

Squaring the unit conversion wrongly. A square metre is 10,000 square centimetres, not 100. The factor of 100 applies to lengths; it gets squared for areas.

Assuming equal perimeters mean equal areas. They do not, and the difference can be several fold.

Using the diagonal as a side. The diagonal is longer than either side. It is the hypotenuse, not a dimension of the rectangle.

Ordering material by area alone. Sheet goods come in fixed sizes, so a 6 m² job may need three 2.4 × 1.2 m sheets rather than two, depending on how the pieces fall. Work out the layout, not just the total.

Frequently Asked Questions

Which side is the length and which is the width?

By convention the longer one is the length, but nothing in the arithmetic depends on it. Area is length times width and multiplication does not care about order, so swapping them changes nothing. Only the labels on your drawing care.

Why can two rectangles with the same perimeter have different areas?

Because perimeter constrains the total of the sides while area depends on their product. A 1 by 12 rectangle and a 6 by 7 rectangle both have a perimeter of 26, but their areas are 12 and 42. For a fixed perimeter the area is largest when the shape is closest to a square.

How do I find the width when I only know the area?

Divide the area by the side you know. That is the area formula rearranged, and it answers questions like how deep a room must be to give a required floor area at a fixed frontage.

Is a square a rectangle?

Yes. A rectangle is any quadrilateral with four right angles, and a square satisfies that with the extra condition that all four sides are equal. Every square is a rectangle, but most rectangles are not squares.

Are both diagonals of a rectangle the same length?

Always, and they bisect each other. That is what makes the diagonal measurement a practical squareness test: if the two diagonals of a frame match, the corners are true right angles.

Last reviewed September 18, 2026 by the CalculatorPeak editorial team.