Home › Geometry › 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
length | number | units | yes | Length of the rectangle. Range: > 0 |
width | number | units | yes | Width of the rectangle. Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
area | number | units² | length × width. |
perimeter | number | units | 2 × (length + width). |
diagonal | number | units | √(length² + width²). |
diagonal_angle_deg | number | degrees | Angle 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
- API:
GET https://tttkmbb.com/api/v1/calculate/rectangle(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/rectangle · Markdown: https://tttkmbb.com/geometry/rectangle.md · JSON definition: https://tttkmbb.com/geometry/rectangle.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="rectangle" - OpenAPI operationId:
calculate_rectangle_properties - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Rectangle (reference)
- Wolfram MathWorld – Rectangle (reference)
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
- Rectangular Prism Calculator — Add a height to get a box's volume and surface area.
- Parallelogram Calculator — Quadrilateral with slanted sides.
- Flooring Calculator — Estimate flooring material for a rectangular room.