Perimeter of a Rectangle Calculator

Enter a rectangle's length and width to get its perimeter (P = 2(l + w)), area (A = l × w), and diagonal (d = √(l² + w²)), plus an optional fencing cost estimate.

Quick Facts

Perimeter formula
P = 2(l + w)
Twice the sum of length and width — the total distance around the edge.
Area formula
A = l × w
Length times width, in square units.
Diagonal formula
d = √(l² + w²)
Follows from the Pythagorean theorem across the two sides.

Your Results

Calculated
Perimeter
-
P = 2 × (length + width)
Area
-
A = length × width
Diagonal
-
d = √(length² + width²)
Estimated Fencing Cost
-
Perimeter × cost per unit length

Ready

Enter a length and width and unit, then press Calculate.

Formula and Method for the Perimeter of a Rectangle

A rectangle is a four-sided polygon with two pairs of equal, parallel sides and four 90° corners. The perimeter is the total distance around its outer edge: P = 2(l + w), where l is the length and w is the width. This calculator also derives the area and diagonal from the same two measurements, plus an optional fencing cost estimate.

How the calculation works

Enter the length, width, and the unit they are measured in. The calculator adds the length and width and doubles the sum to get the perimeter (P = 2(l + w)) — equivalently 2l + 2w, since each pair of opposite sides has the same length. It multiplies length by width to get the area (A = l × w, in square units), and applies the Pythagorean theorem to get the diagonal (d = √(l² + w²)), since the diagonal is the hypotenuse of the right triangle formed by one length side and one width side. If you enter a cost per unit length, the tool multiplies it by the perimeter to estimate total fencing or edging cost.

Common mistakes

  • Confusing perimeter with area: a rectangle 8 ft long and 5 ft wide has a perimeter of 2 × (8 + 5) = 26 ft, not an area of 40 ft² — they measure different things in different units.
  • Doubling only one side: the formula is 2(l + w), not 2l + w or l + w. Forgetting to double both sides is a common shortcut error.
  • Mixing units: keep length and width in the same unit — convert inches to feet, or centimeters to meters, before entering either value.

Real-world applications

  • Fencing, edging, and baseboard projects use perimeter directly to determine how much linear material to buy.
  • Framing and layout checks use the diagonal to confirm a rectangle is truly square-cornered — equal diagonals confirm 90° corners.
  • Flooring and landscaping budgets combine perimeter with a cost per unit length to estimate fencing or trim costs before purchasing.
  • Room and lot planning use both perimeter and area together: perimeter for boundary materials, area for surface materials like flooring or sod.

Frequently Asked Questions

What is the formula for the perimeter of a rectangle?
The perimeter of a rectangle equals twice the sum of its length and width: P = 2(l + w). For example, a rectangle 8 ft long and 5 ft wide has a perimeter of 2 × (8 + 5) = 26 ft.
How is the perimeter different from the area?
Perimeter is the total distance around the outside edge, measured in linear units (ft, m); area is the space covered inside the rectangle, measured in square units (ft², m²). Perimeter uses P = 2(l + w), while area uses A = l × w — they answer different questions and are not interchangeable.
How do I find the diagonal of a rectangle?
Use the Pythagorean theorem: d = √(l² + w²), since the diagonal is the hypotenuse of the right triangle formed by the length and width. A rectangle 8 ft by 5 ft has a diagonal of √(64 + 25) = √89 ≈ 9.43 ft.
How much fencing do I need for a rectangular yard?
You need at least the perimeter length of fencing, P = 2(l + w). Add extra for gate posts, corner posts, and waste — many installers recommend rounding up by 5-10% and accounting for post spacing separately.