Irregular trapezoid area calculator
Measure the two parallel sides and the gap between them to get the area of any trapezoid, crooked legs included: bases of 10 and 6 metres, 4 metres apart, give 32 square metres. Handy for plots, roof planes and channels. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Base a
- 10
- Base b
- 6
- Height
- 4
- Mean base
- 8
- Area
- 32
two parallel sides and height, free
Why irregular trapezoids are everywhere
Textbook geometry loves the isosceles trapezoid, where both legs match and every angle is predictable. Real measurements rarely cooperate. A garden plot bounded by a road and a river, a gable roof cut by a dormer, a channel cross-section dug by hand, an offcut of plywood from a larger sheet: all of these are trapezoids whose non-parallel sides have nothing in common.
The good news is that the area formula does not care. Because the area depends only on the two parallel sides and the perpendicular distance between them, you can ignore the slanted legs entirely — their length and angles are irrelevant to the surface. If the two bases measure 10 and 6 metres with 4 metres of separation, the area is 32 square metres, whether the left leg is vertical or leans at any angle.
The calculator returns that area together with the mean base, the intermediate value (a + b) / 2, so you can sanity-check the arithmetic against a sketch.
How the computation works and what it rejects
The algorithm is one line of arithmetic applied with strict validation. In geometry a zero or negative base describes no figure at all, and silently clamping it to a small positive value would produce an area that looks plausible while being wrong — the worst kind of answer for a quantity that feeds material orders or land valuations. Results are rounded to ten decimal places so that the same request returns byte-identical output on any machine, which matters when the response is stored, compared or replayed in tests.
There is no randomness, no clock, no network call: the function is a pure mapping from three numbers to an area.
What you can do with it
Estimate an irregular land parcel
Survey a plot bounded by two roughly parallel fences: measure both fence lines and the perpendicular distance between them, and get the area without knowing the angles.
Price roofing or flooring on a non-rectangular plan
Convert a trapezoidal roof plane or floor section into square metres so material quantities and quotes are based on the real surface, not a rectangular guess.
Check channel and gutter cross-sections
Compute the cross-sectional area of a trapezoidal drainage channel from its top width, bottom width and depth — the first step of any flow-capacity estimate.
FAQ
Which measurements do I need?
The slanted legs are never needed for the area.
Does it work for non-isosceles (irregular) trapezoids?
Yes. The formula A = (a + b) / 2 x h holds for every trapezoid regardless of the leg lengths or angles, which is why only three measurements are required.
What input is rejected?
Any value that is not a positive finite number: zero, negatives, NaN, Infinity, booleans, empty strings and non-numeric text.
Is the result deterministic?
Yes. The same three inputs always produce byte-identical output; results are rounded to ten decimal places so the response is stable across machines.
What is the mean base shown next to the area?
It is the average of the two parallel sides, (a + b) / 2, and multiplying it by the height gives the area. For bases of 10 and 6 the mean base is 8, which lets you check the result against a quick sketch.
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/math/irregular-trapezoid-area \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"base_a":10,"base_b":6,"height":4}'const res = await fetch("https://api.kit.forhosting.com/math/irregular-trapezoid-area", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"base_a": 10,
"base_b": 6,
"height": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/irregular-trapezoid-area",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"base_a": 10,
"base_b": 6,
"height": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/irregular-trapezoid-area", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"base_a":10,"base_b":6,"height":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"base_a":10,"base_b":6,"height":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/irregular-trapezoid-area", 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": 10,
"base_b": 6,
"height": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.irregular_trapezoid_area",
"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
The irregular trapezoid area API computes the surface of any trapezoid from the only three measurements that matter: the two parallel sides and the perpendicular height between them. It does not ask whether the legs are equal, whether the angles are right, or whether the figure is isosceles — the formula A = (a + b) / 2 x h holds for every trapezoid, regular or not, which is exactly what makes it useful for real-world plots of land, roof planes, cross-sections and sheet material that never come in tidy shapes. You send three positive numbers, you get back the area plus the mean base used to derive it, in one deterministic call that runs in microseconds and costs $0.002 per request.
Why irregular trapezoids are everywhere
That is the insight behind this endpoint: instead of forcing you to measure diagonals, angles or leg lengths that are awkward to reach on a physical site, it asks only for the three values a tape measure or a site plan already gives you.
How the computation works and what it rejects
Each of the three inputs — base_a, base_b and height — is parsed as a finite number, whether it arrives as a JSON number or as a plain numeric string such as "7.25". Anything that is not a positive finite number is rejected with an invalid_input error and is never billed: zero, negative lengths, NaN, Infinity, booleans, empty strings and text like "ten" all fail before a single multiplication happens. That strictness is deliberate. Once the inputs pass, the mean base is computed as (base_a + base_b) / 2 and multiplied by the height.
Using it from the web page and from your code
Typical integrations include land-survey tools that split parcels into trapezoidal strips, construction estimators that price roofing or flooring over non-rectangular plans, and educational software that checks student answers against a reference computation. Through the API you post a small JSON object with base_a, base_b and height — the aliases a, b and h are accepted for convenience — and you receive the area, the mean base and the echoed inputs in a single response. Each call costs $0.002, with no per-unit surcharge, and invalid input is rejected without charge. Because the endpoint is stateless and deterministic, it caches cleanly in front of your own infrastructure and behaves identically under load, in tests and in production.
Technical questions
What does it cost?
$0.002 per request, with no per-unit surcharge. It is also free to run in your browser on this page.
Can I send the values as strings?
Yes. Plain numeric strings such as "7.25" are accepted, as are JSON numbers. The aliases a, b and h work in place of base_a, base_b and height.