ForHosting KIT · Math

Rectangle diagonal angle calculator

A 4 by 3 rectangle has a diagonal of 5 that meets the length at arctan(3/4) and the width at arctan(4/3), two angles that always add up to 90°. Enter both sides and get each angle in degrees and radians. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Length
4
Width
3
You get
Diagonal
5
Angle with length deg
36.8698976458
Angle with length rad
0.6435011088
Angle with width deg
53.1301023542

A rectangle has four right angles and two equal diagonals that each split the figure into a pair of congruent right triangles. Given only the length and the width, this calculator returns the angle that one diagonal makes with each adjacent side, in both degrees and radians. The length-side angle is the arctangent of width over length; the width-side angle is the arctangent of length over width. Those two angles are complementary: they add to ninety degrees, or π over two radians. A square is the special case where both angles are forty-five degrees.

How the diagonal angles of a rectangle are computed

Draw a rectangle of length L and width W and then one of its two equal diagonals. That diagonal is the hypotenuse of a right triangle whose legs are the two sides, so its length is the Euclidean hypot of L and W. At the corner where the diagonal meets the length side, the opposite leg is the width and the adjacent leg is the length, therefore the angle with the length is the two-argument arctangent atan2(W, L), which equals arctan(W/L) for every strictly positive pair.

At the opposite acute corner the roles reverse: the angle with the width is atan2(L, W), or arctan(L/W). Because the triangle is right-angled, those two acute angles are complementary and must sum to ninety degrees, which is π over two radians — a cheap sanity check for any implementation. A square, where L equals W, yields forty-five degrees on both sides, matching the isosceles right triangle that a square diagonal creates.

Classic checks include length four and width three, the 3-4-5 family, whose length-side angle is arctan(3/4) and whose width-side angle is arctan(4/3); and any equal pair such as length one and width one, which yields forty-five degrees and π over four radians twice. Swapping the labels of length and width simply swaps the two reported angles, so the geometry is unchanged and only the naming of the sides moves. The path uses a single hypot and two atan2 calls: it is deterministic, constant-time, and free of iterative solvers.

What you send and what you get back

Provide two required finite numbers: length is one side of the rectangle and width is the adjacent side. Both must be strictly positive; zero is not accepted, because a collapsed side leaves the diagonal lying on the remaining side and the angle is no longer a well-defined interior corner.

Example checks: length four and width three yield a diagonal of five with complementary angles arctan(3/4) and arctan(4/3); length one and width one yield a diagonal of the square root of two and two equal forty-five-degree angles; a length of zero or minus three fails naming the field. Wire the free browser tool for quick sanity checks, then call the identical contract from scripts for bulk evaluation without reimplementing atan2 in every language. Invalid input is not charged, so exploratory validation in CI stays cheap while production calls remain predictable.

Where rectangle diagonal angles show up in real work

Secondary-school and college geometry courses constantly ask for the angle a rectangle diagonal makes with a given side, often alongside the 3-4-5 triple and the special case of a square; a trusted calculator with a strict positive-side gate speeds homework grading and removes spreadsheet mistakes where someone divides the sides the wrong way around or forgets to convert radians.

Construction, cabinetry, and sheet-metal shops convert a measured diagonal on a rectangular panel into the mitre or bevel at the corner; the same two angles feed CNC toolpaths and stair-stringer layouts once the shop unit is applied downstream. Architecture and interior-design tools review axis-aligned rooms and openings; the diagonal angle tells whether a brace, a sight line, or a cable run will clear a corner. Game, graphics, and CAD libraries store axis-aligned bounding boxes; the complementary pair supports layout math, camera framing, and collision proxies without a full computational-geometry stack.

If you later need rectangle area, a generic right-triangle solve from two of three sides, or a screen-size converter from a television diagonal, treat those as separate search intents rather than overloading this rectangle-diagonal-angle landing.

Homework and exam checks

Compute the complementary diagonal angles from length and width, and reject zero or negative sides with a clear error.

Panels, mitres, and shop layouts

From measured length and width, recover the corner angles a diagonal brace or cut makes with each side.

Bounding boxes in games and CAD

Turn two extents into the diagonal length and its side angles for layout, framing, and axis-aligned box metrics.

What formula does this calculator use?

The response includes formula set to those identities, both angles in degrees and radians, and the diagonal √(length²+width²).

What happens if length or width is zero or negative?

Each dimension must be a finite positive number strictly greater than zero; the error message names the field.

Why are two angles returned instead of one?

A diagonal meets two sides. The length-side and width-side angles are complementary and sum to 90°. Returning both removes the ambiguity of which side the angle is measured from.

Does a square give 45 degrees?

Yes. When length equals width the two right triangles are isosceles, so both angles are 45 degrees (π/4 radians) and the diagonal is length times √2.

What does it cost?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/math/rectangle-diagonal-angle

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/math/rectangle-diagonal-angle \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"length":4,"width":3}'
{
  "length": 4,
  "width": 3
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.rectangle_diagonal_angle",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

A missing, non-finite, zero, or negative side is rejected with a clear invalid_input error instead of a silent nonsense angle. No network calls, no random sampling, and no clock reads — only ordinary IEEE-754 arithmetic on the numbers you provide.

How the diagonal angles of a rectangle are computed

Huge magnitudes can still overflow the IEEE-754 double range; when hypot or either angle is non-finite the request fails with a clear message instead of returning Infinity in JSON. The response echoes both inputs, the diagonal, four angle fields, and a short formula string so logs, worksheets, and teaching UIs can document the algorithm without re-deriving it.

What you send and what you get back

Missing fields, empty strings, non-numeric text, NaN, Infinity, zero, and any negative dimension are rejected with invalid_input and are not charged. On success the JSON response returns length, width, diagonal, angle_with_length_deg, angle_with_length_rad, angle_with_width_deg, angle_with_width_rad, and formula set to the pair of arctangent identities so logs and teaching UIs can document the algorithm. API pricing is the published base of $0.002 per successful item.

Where rectangle diagonal angles show up in real work

Because this capability is a pure parse engine, failed validation does not consume balance and successful runs stay at $0.002 per item.

Read the full KIT documentation →