Trapezoid diagonal calculator
Get both diagonals of a trapezoid from its two bases, two legs and height. Bases 6 and 12 with legs of 5 and a height of 4 give two diagonals of 9.848857801796, ready for bracing or cut lists. Impossible shapes are rejected. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Base a
- 6
- Base b
- 12
- Leg c
- 5
- Leg d
- 5
- Height
- 4
- Diagonal 1
- 9.8488578018
- Diagonal 2
- 9.8488578018
A trapezoid (trapezium in British usage) is a quadrilateral with exactly one pair of parallel sides, the bases. Once you know both base lengths, both non-parallel legs, and the perpendicular height between the bases, the two diagonals are fully determined by Euclidean geometry: place the figure in the plane, recover the horizontal offsets of the top base, and measure the distances from opposite corners. This trapezoid diagonal calculator accepts those five lengths, checks that they form a real trapezoid, and returns both diagonal lengths with a stable method tag. No network calls, no random sampling, and no Date.
Where trapezoid diagonal lengths show up in real work
Secondary-school and college geometry courses constantly ask for the diagonals of a trapezoid once the bases, legs, and height are known; a trusted calculator with a strict consistency gate speeds homework grading and removes spreadsheet mistakes where someone applies a rectangle diagonal formula to a non-rectangular trapezoid. Architecture and civil workflows use trapezoidal sections for roof pitches, embankment cross-sections, and bracing layouts; diagonal lengths feed cut lists and clearance checks when only the outline dimensions are surveyed.
Game, graphics, and CAD libraries store trapezoidal quads for terrain skirts, UI panels, and UV shells; deterministic diagonals support collision proxies and layout math without a full computational-geometry stack. If you later need only trapezoid area and midsegment from two bases and height, or the count of diagonals in an n-gon, treat those as separate search intents rather than overloading this trapezoid-diagonal landing—the area path lives under the trapezoid area calculator, and n-gon diagonal counting is a different combinatorial problem.
What you can do with it
Bracing and cut lists
From surveyed base, leg, and height lengths, recover diagonal lengths for roof, embankment, and plate fabrication notes.
FAQ
Why can a request fail even when every length is positive?
The five lengths must form a planar trapezoid of the given height. Each leg must be at least the height, and the implied horizontal offsets must match both legs.
What if the two bases are equal?
Equal bases force equal legs under this model (same height and same offset magnitude). Unequal legs with equal bases are rejected as inconsistent; equal legs yield a parallelogram-style placement with well-defined diagonals.
What does it cost?
The browser tool is free and runs locally.
What are the diagonals of a trapezoid with bases 6 and 12, legs of 5 and a height of 4?
Both diagonals measure 9.848857801796. They come out equal because the two legs are the same length, which makes the trapezoid isosceles.
Can I use the rectangle diagonal formula on a trapezoid?
No, that is a common slip. A trapezoid's diagonals depend on how far the top base is shifted over the bottom one, and the legs together with the height fix that shift.
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/geom/trapezoid-diagonal \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"base_a":6,"base_b":12,"leg_c":5,"leg_d":5,"height":4}'const res = await fetch("https://api.kit.forhosting.com/geom/trapezoid-diagonal", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"base_a": 6,
"base_b": 12,
"leg_c": 5,
"leg_d": 5,
"height": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geom/trapezoid-diagonal",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"base_a": 6,
"base_b": 12,
"leg_c": 5,
"leg_d": 5,
"height": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geom/trapezoid-diagonal", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"base_a":6,"base_b":12,"leg_c":5,"leg_d":5,"height":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"base_a":6,"base_b":12,"leg_c":5,"leg_d":5,"height":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geom/trapezoid-diagonal", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"base_a": 6,
"base_b": 12,
"leg_c": 5,
"leg_d": 5,
"height": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geom.trapezoid_diagonal",
"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
Students checking homework, civil and structural notes that need cross-bracing lengths across trapezoidal sections, CAD and fabrication teams sizing plates with known height, and automated graders that must fail impossible figures all get the same pure result in the free browser tool and the paid API. Inconsistent input—legs shorter than the height, or lengths that cannot close under the given height—fails with invalid_input instead of inventing a diagonal.
How both trapezoid diagonals are computed from sides and height
Each leg is the hypotenuse of a right triangle of vertical side height, so both legs must be at least the height. Classic isosceles checks include bases six and ten with equal legs five and height four only after the legs equal the true hypotenuse of the overhang; bases six and ten with height four and legs equal to the square root of twenty yield equal diagonals of square root of eighty. Because the path uses only arithmetic and square roots, it is deterministic, O(1), and free of iterative solvers. Label the parallel sides base_a and base_b and the non-parallel legs leg_c and leg_d, with height the perpendicular distance between the supporting lines of the bases. Place base_b on the x-axis from the origin to (base_b, 0) and base_a at y equals height from (x, height) to (x plus base_a, height). Then leg_c is the segment from (0, 0) to (x, height) and leg_d is the segment from (base_b, 0) to (x plus base_a, height). Writing m for base_b minus base_a, the left offset solves as x equals (m squared plus leg_c squared minus leg_d squared) divided by (two m) when the bases differ; when the bases are equal the figure forces the legs to be equal and x becomes the real square root of leg_c squared minus height squared. After x is known, the two diagonals are the distances from (0, 0) to (x plus base_a, height) and from (base_b, 0) to (x, height). The solver re-checks that the implied leg lengths match the inputs within a tight floating tolerance; any mismatch means the five numbers cannot form a planar trapezoid and the request fails.
What you send and what you get back
Numeric fields are rounded to twelve decimal places for stable goldens across runtimes. Example checks: an isosceles trapezoid with bases six and ten, height four, and matching legs yields two equal diagonals; swapping which base is longer only changes the offset sign pattern, not the validity of a well-posed figure; a leg of three with height four fails naming the leg constraint. Wire the free browser tool for quick sanity checks, then call the identical contract from scripts for bulk evaluation without reimplementing the offset algebra in every language. Provide five required finite positive numbers: base_a and base_b for the parallel sides, leg_c and leg_d for the non-parallel sides, and height for the perpendicular distance between the bases. Missing fields, empty strings, non-numeric text, NaN, Infinity, non-positive dimensions, a leg shorter than the height, equal bases with unequal legs, and any other inconsistent combination are rejected with invalid_input and are not charged. On success the JSON response echoes base_a, base_b, leg_c, leg_d, and height, returns diagonal_1 and diagonal_2 from the coordinate placement described above, and sets method to trapezoid_diagonals_from_sides_height so logs and teaching UIs can document the algorithm. API pricing is the published base of $0.002 per successful item.
Where trapezoid diagonal lengths 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.
Integration use cases
Homework and exam checks
Compute both trapezoid diagonals from bases, legs, and height, and reject inconsistent figures with a clear invalid_input error.
CAD and game trapezoidal quads
Turn five outline lengths into both diagonals for layout, collision proxies, and self-describing geometry fixtures in browser or API.
Technical questions
What inputs does the trapezoid diagonal calculator need?
Five positive finite lengths: base_a and base_b (parallel sides), leg_c and leg_d (non-parallel sides), and height (perpendicular distance between the bases). Aliases a/b/c/d/h are accepted.
How are the two diagonals defined?
With base_b on the bottom and base_a on top, diagonal_1 runs from the left end of base_b to the right end of base_a, and diagonal_2 runs from the right end of base_b to the left end of base_a. The response includes method: "trapezoid_diagonals_from_sides_height".