🧮
🧮 Math & statistics

Rectangle & Square Calculator

Results update as you type.

Your numbers

Understanding the rectangle and square calculator — concept and principle

A rectangle is a four-sided shape with four right angles; a square is the special rectangle whose four sides are equal. From the length and width this calculator gives the area, the perimeter and the diagonal. These are among the most used measurements in daily life: floor area for flooring or rent, wall area for paint or wallpaper, fence or skirting-board length, and the diagonal size of a screen, a door frame or a box.

8 by 5 rectangle covered with 40 tilesAn 8 by 5 floor takes 40 unit tiles, so the area is 40. The red border is 8 + 5 + 8 + 5 = 26 long. The dashed diagonal is √(64 + 25) = √89 ≈ 9.43.Tiling an 8 × 5 floor≈ 9.43length 8width 5tiles 8 × 5area 40red edge2(8+5) = 26diagonal√89 ≈ 9.43
Area counts the tiles inside; perimeter measures the edge around them.

How it is calculated

For a square, set a = b, so A = a², P = 4a and d = a√2. Both inputs must use the same unit. The perimeter and diagonal are in that unit, and the area is in that unit squared (m², cm², ft²).

The principle

Area counts how many unit squares fit inside the shape. A rectangle 8 units long and 5 units wide holds 5 rows of 8 unit squares, so 40 squares in total; the same idea extends to non-whole lengths. The perimeter simply walks around the edge: two lengths and two widths. The diagonal cuts the rectangle into two right triangles whose legs are the length and the width, so by the Pythagorean theorem its square equals a² + b². This is also the practical test for squareness on a building site: if both diagonals of a frame are equal, its corners are right angles.

Worked example

  1. Inputs: length a = 8, width b = 5.
  2. Area: 8 × 5 = 40.
  3. Perimeter: 2 × (8 + 5) = 2 × 13 = 26.
  4. Diagonal: √(64 + 25) = √89 ≈ 9.433981132.
How Area changes with LengthHow Area changes with Length0204060802468101216Example: 40Length
Each point is the calculator re-run with only “Length” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
LengthArea
210
420
630
840
1050
1260
1680

How to read the result

For a fixed perimeter, the square gives the largest area. A 26-unit perimeter could enclose 6.5 × 6.5 = 42.25 square units instead of 40, while a long thin 12 × 1 rectangle encloses only 12. When ordering materials, area tells you how much flooring, paint or turf to buy, and perimeter tells you how much edging, trim or fencing you need. Most suppliers recommend adding a waste allowance for cuts.

Common mistakes

Keep in mind: Real rooms are rarely perfect rectangles. Walls may be out of square, and doors, windows and alcoves change the true area, so measure each part, and for building work follow local codes and a qualified professional’s advice.

Frequently asked questions

How do I find the width from the area and the length?

Divide: b = A ÷ a. An area of 40 with length 8 gives width 5.

How do I find the side of a square from its diagonal?

s = d ÷ √2. A diagonal of 10 gives a side of about 7.071.

Why do A-series paper sizes keep the same shape when halved?

ISO 216 uses a length-to-width ratio of √2 : 1, so cutting a sheet in half across its long side gives the same proportions.

Sources: Euclid, Elements, Book I, Proposition 47 (Pythagorean theorem) · ISO 216, Writing paper and certain classes of printed matter — Trimmed sizes — A and B series

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →