HomeGeometry › Rectangle Calculator

Rectangle Calculator

Computes the area, perimeter and diagonal of a rectangle from its length and width. Lengths are unit-agnostic; the area is in the square of the input unit.

When to use

You need the area, perimeter or diagonal of a rectangle or square (enter equal length and width).

Do not use when: The shape is a box with depth (use rectangular-prism) or a slanted quadrilateral (use parallelogram or trapezoid).

Formula

area = length × width; perimeter = 2 × (length + width); diagonal = √(length² + width²); diagonal_angle_deg = atan(width / length)

Inputs

ParameterTypeUnitRequiredDescription
lengthnumberunitsyesLength of the rectangle. Range: > 0
widthnumberunitsyesWidth of the rectangle. Range: > 0

Outputs

OutputTypeUnitDescription
areanumberunits²length × width.
perimeternumberunits2 × (length + width).
diagonalnumberunits√(length² + width²).
diagonal_angle_degnumberdegreesAngle between the diagonal and the length side = atan(width / length).

Example

5 by 3: {"length":5,"width":3}{"area":15,"perimeter":16,"diagonal":5.831,"diagonal_angle_deg":30.9638}

12 by 5: {"length":12,"width":5}{"area":60,"perimeter":34,"diagonal":13,"diagonal_angle_deg":22.6199}

GET https://tttkmbb.com/api/v1/calculate/rectangle?length=5&width=3

Machine access

Sources

FAQ

Does it matter which side is the length?

No for area, perimeter and diagonal. Only diagonal_angle_deg is measured from the side entered as length.

How do I use it for a square?

Enter the same value for length and width; the diagonal is then side × √2 and the diagonal angle is 45°.

Related calculators