Perimeter of a Rectangle Calculator
Enter the width and the length of a rectangle, choose the unit, and the calculator gives the perimeter in that unit. Below you will find the formula, worked examples and a few related shortcuts.
Related calculators
Created by the Reeliy Editorial Team. Last updated: Oct 19, 2026
Perimeter of a rectangle formula
A rectangle has two pairs of equal sides. Walking once around the edge, you cover the width twice and the length twice:
P = 2 × (w + l) = 2w + 2lw is the width, l is the length, both in the same unit.
The formula can be turned around when one measurement is missing:
- Missing length from the perimeter: l = P ÷ 2 − w.
- Missing length from the area A: l = A ÷ w, after which the formula above applies.
- Diagonal, if you need it: d = √(w² + l²). A 3 by 4 rectangle has a diagonal of 5.
How to use the calculator
- Enter the Width and the Length. They start at 3 and 4, and either may be swapped without changing the result.
- Pick the Metric (the unit) that both measurements are in: mm, cm, dm, meter, km, in, ft, yd or mile.
- Press Calculate to read the Rectangle perimeter, given in that same unit.
Both fields must be filled in and cannot be negative. The answer is rounded to six decimals, with trailing zeros removed in pairs, so 14 prints as 14 and 19.5 prints as 19.50. If your two measurements are in different units, convert one of them first or use the perimeter calculator, which has a unit select for each side.
Example perimeter of a rectangle problems
Example 1: fencing a garden. A garden is 12.5 m wide and 8 m long. P = 2 × (12.5 + 8) = 2 × 20.5 = 41 m. If fencing costs 18.50 per metre, the fence comes to 41 × 18.50 = 758.50.
Example 2: a picture frame. The frame around a photo is 40 cm by 30 cm. The moulding must run 2 × (40 + 30) = 140 cm, plus a little extra for the mitred corners.
Example 3: a swimming pool. A lap pool measures 25 m by 10 m, so the pool edge is 2 × (25 + 10) = 70 m long. That is the length of coping stones or edge tile you would need.
Example 4: working backwards. A rectangular plot has a perimeter of 50 m and a width of 8 m. Half the perimeter is 25, so the length is 25 − 8 = 17 m. Check: 2 × (8 + 17) = 50.
Same perimeter, different areas
Perimeter alone does not fix the size of a rectangle. All the rectangles in the table below have a perimeter of 24, yet their areas range from 11 to 36.
| Width | Length | Perimeter | Area |
|---|---|---|---|
| 1 | 11 | 24 | 11 |
| 2 | 10 | 24 | 20 |
| 3 | 9 | 24 | 27 |
| 4 | 8 | 24 | 32 |
| 5 | 7 | 24 | 35 |
| 6 | 6 | 24 | 36 |
When width equals length the rectangle is a square, and the formula simplifies to P = 4a. The perimeter of a square calculator uses exactly that, and the area of a rectangle calculator gives the matching area.
Where the perimeter of a rectangle is used
Most everyday rectangles are measured by their edge before anything else: the fence around a yard, the baseboards in a bedroom, the moulding on a mirror, the border strip on a rug, or the tape needed to mark out a sports pitch. In each case the perimeter tells you how much linear material to buy. Add a margin of 5 to 10 percent for cuts and corners, and round up to the next full length the shop sells.
Common mistakes
- Adding the width and length only once. That gives the semi-perimeter, half of the real distance around.
- Multiplying width by length. That is the area, measured in square units, not the perimeter.
- Mixing units, such as a width in metres with a length in centimetres. Convert first, or the result is meaningless.
For shapes other than rectangles, such as triangles, circles and trapezoids, see the perimeter calculator or the circumference of a circle calculator.
Frequently asked questions
What is the formula for the perimeter of a rectangle?
P = 2 × (width + length). It is the sum of all four sides, and because opposite sides are equal this is the same as twice the width plus twice the length.
How do I find the length of a rectangle if I know the perimeter and the width?
Divide the perimeter by 2 and subtract the width. With a perimeter of 50 and a width of 8, the length is 25 − 8 = 17.
Can two rectangles have the same perimeter but different areas?
Yes. A 2 by 10 rectangle and a 6 by 6 square both have a perimeter of 24, but their areas are 20 and 36.
Does the order of width and length matter?
No. The formula adds them together, so swapping width and length gives the same perimeter.
Cite this calculator and page
If you use this page in your work, you can cite it as:
Reeliy Editorial Team. (2026). Perimeter of a Rectangle Calculator. Reeliy. https://reeliy.com/calculators/perimeter-of-rectangle-calculator“Perimeter of a Rectangle Calculator.” Reeliy, 2026, https://reeliy.com/calculators/perimeter-of-rectangle-calculator.