Parallelogram diagonal calculator from sides and angle
Sides of 5 and 8 meeting at 60° give diagonals of about 11.3578166916005 and exactly 7, in the same unit as the sides. Both lengths come from the law of cosines, one with a plus sign and one with a minus sign. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Side a
- 5
- Side b
- 8
- Angle
- 60
- Angle unit
- Degrees
- Diagonal 1
- 11.3578166916
- Diagonal 2
- 7
This parallelogram diagonal calculator finds both corner-to-corner lengths when you know two adjacent sides and the angle between them. It applies the law of cosines to the two triangles formed by the diagonals, using one plus and one minus form of the same expression. Enter positive side lengths in any consistent unit, choose degrees or radians, and supply a nondegenerate interior angle. The result preserves your length unit, identifies both diagonals, echoes the normalized inputs, and records the formula used.
Why one pair of sides and one angle determines both diagonals
A parallelogram has two pairs of equal, parallel sides, so two adjacent side lengths and their included interior angle fix its shape and scale. Draw either diagonal and the figure splits into two congruent triangles. One diagonal lies opposite the supplied angle.
Applying the law of cosines to that triangle gives its squared length as a squared plus b squared minus two times a times b times the cosine of the angle. The other diagonal belongs to the supplementary interior angle, whose cosine is the negative of the original cosine. Substituting that fact changes the minus sign to a plus sign, giving a squared plus b squared plus two times a times b times cosine of the supplied angle.
The calculator evaluates both expressions and takes their nonnegative square roots. At ninety degrees, cosine is zero, so the diagonals are equal and the parallelogram is a rectangle. If the adjacent sides are also equal, that special case is a square.
Both answers use exactly the same linear unit as the sides.
How to enter measurements and interpret the result
You may use metres, centimetres, inches, feet, or any other linear unit, but do not mix units unless you convert them first. The angle is the interior angle directly between those adjacent sides, not an exterior turning angle and not an angle made by a diagonal. A valid nondegenerate parallelogram requires an angle strictly greater than zero and strictly less than one hundred eighty degrees, equivalently between zero and pi radians.
For example, sides of equal length with a sixty-degree included angle form a rhombus whose diagonals have different lengths. A rectangle with sides three and four and a ninety-degree angle returns two diagonals of five. Numeric outputs are rounded consistently to suppress insignificant floating-point noise.
Practical checks, limitations, and automation
The quickest sanity check is the parallelogram identity: the sum of the squares of the two diagonals equals twice the sum of the squares of the adjacent sides. A second useful check is symmetry. Replacing an acute included angle with its supplementary obtuse angle swaps the plus-form and minus-form lengths, reflecting the same parallelogram viewed from the neighboring corner.
This capability deliberately solves only the SAS-style problem described here. It does not infer missing sides, calculate angles from diagonals, convert mixed length units, return area or perimeter, or decide whether noisy survey measurements describe a perfect parallelogram. Convert units before calling it and use a dedicated inverse solver when your known measurements differ.
Interactive browser calculations are free.
What you can do with it
Construction and fabrication layouts
Calculate both brace or corner-to-corner lengths for a slanted four-sided frame from its adjacent edges and included angle.
Geometry homework and answer keys
Check law-of-cosines exercises for rectangles, rhombi, and general parallelograms with a reproducible pair of diagonal lengths.
FAQ
What formulas are used for the two diagonals?
The calculator uses d1 = sqrt(a² + b² + 2ab cos θ) and d2 = sqrt(a² + b² − 2ab cos θ), where θ is the included angle.
Can I enter the angle in radians?
Otherwise the default is degrees. The angle must lie strictly between zero and pi radians, or zero and 180 degrees.
Which measurement unit does the result use?
Both sides must be expressed in one consistent unit before calculation.
Why are both diagonals equal for a rectangle?
A rectangle has a ninety-degree included angle, so cos 90° is zero. The plus and minus formulas therefore reduce to the same square root.
What does the calculator cost?
It is free to use in the browser.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/trig/diagonal-of-parallelogram \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"side_a":5,"side_b":8,"angle":60}'const res = await fetch("https://api.kit.forhosting.com/trig/diagonal-of-parallelogram", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"side_a": 5,
"side_b": 8,
"angle": 60
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/trig/diagonal-of-parallelogram",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"side_a": 5,
"side_b": 8,
"angle": 60
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/trig/diagonal-of-parallelogram", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"side_a":5,"side_b":8,"angle":60}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"side_a":5,"side_b":8,"angle":60}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/trig/diagonal-of-parallelogram", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"side_a": 5,
"side_b": 8,
"angle": 60
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "trig.diagonal_of_parallelogram",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Because the calculation is pure and deterministic, the browser tool and API return the same values without network lookups, random sampling, or hidden geometric assumptions.
Why one pair of sides and one angle determines both diagonals
For acute angles, the plus-form diagonal is longer; for obtuse angles, the labels can reverse in size, which is why the response reports formula-based diagonal_1 and diagonal_2 instead of claiming that one fixed field is always the longer diagonal.
How to enter measurements and interpret the result
Provide side_a and side_b as positive finite numbers, using the same unit for both. Choose angle_unit as degrees or radians; degrees is the default. Endpoints are rejected because they collapse the figure into a line. On success, diagonal_1 corresponds to the plus form, square root of a squared plus b squared plus two a b cosine angle. diagonal_2 corresponds to the minus form. The response echoes the input angle and unit and includes a compact formula string, making it suitable for worksheets, audit logs, CAD helpers, and deterministic automated tests.
Practical checks, limitations, and automation
Swapping side_a and side_b cannot change either diagonal because the formulas contain the same squared terms and product. The implementation scales the side lengths before squaring, which reduces overflow risk for large valid numbers, validates every field, and rejects non-finite values and degenerate angles with invalid_input. Automated API requests cost $0.002 per successful item, while invalid requests are not charged.
Integration use cases
CAD and testing fixtures
Generate deterministic diagonal values for drawing tools, constraint checks, spreadsheets, and automated geometry unit tests.