Midhinge calculator
The midhinge calculator summarizes the center of a numeric sample by averaging its first and third quartiles.
Run — free
It validates the supplied array, sorts a copy, calculates Q1 and Q3 with Tukey's exclusive-halves convention, and returns their average alongside the quartiles used. This makes the result transparent and reproducible for exploratory statistics, quality checks, reports, and automated data pipelines without changing the order of the original input.
What the midhinge tells you
The midhinge is the arithmetic mean of the first quartile and the third quartile: add Q1 and Q3, then divide by two. Because those quartiles describe the boundaries of the middle half of a sample, their midpoint offers a compact indication of central location. It differs from the ordinary mean, which uses every observation directly, and from the median, which is based on the central position. That distinction matters when a distribution is asymmetric or contains extreme observations. A very large maximum can pull the mean sharply upward while leaving the quartiles, and therefore the midhinge, comparatively stable. The calculator returns Q1 and Q3 as well as the final midhinge so you can inspect the ingredients instead of accepting an unexplained figure. It also returns the observation count and the named quartile method, making the result easier to record, compare, and reproduce in a report or another statistical tool. Use the midhinge as one descriptive summary, not as a replacement for viewing the sample's spread and shape.
How the calculation handles quartiles
Quartiles can be defined by several conventions, and different spreadsheet or statistics packages may produce different Q1 and Q3 values for a small sample. This calculator uses Tukey's exclusive-halves convention. It first sorts the numbers in ascending order. For an even number of observations, the lower and upper halves contain the same number of values. For an odd number, the overall middle observation is excluded from both halves. Q1 is the median of the lower half, Q3 is the median of the upper half, and the midhinge is their average. If a half contains an even number of values, its median is the average of its two central values. A sample containing one number is treated as a degenerate case in which Q1, Q3, and the midhinge all equal that number. The response labels the method as tukey_exclusive, so downstream code does not have to infer the convention. When comparing results elsewhere, confirm that the other system uses the same rule before treating a difference as an error.
Preparing input and interpreting the response
Provide numbers as a non-empty JSON array. Every element must already be a finite numeric value; numeric-looking strings, blank values, null, Infinity, and NaN are rejected rather than silently converted or omitted. Strict validation prevents a result from appearing valid after malformed observations have disappeared from the calculation. Input order does not matter because the algorithm sorts a copy internally, and repeated values remain part of the sample. Negative numbers, zero, decimals, and scientific-notation numeric values are all acceptable when represented as actual JSON numbers. The response contains count, q1, q3, midhinge, and method. Keep Q1 and Q3 with the computed value when auditability matters, since they reveal whether the midpoint comes from a narrow or wide interquartile region. For automation, an API request starts at $0.002; the browser implementation uses the same deterministic calculation. If the array is empty or contains a non-numeric element, the request fails with an invalid-input error that identifies the problem instead of returning a partial statistic.
What you can do with it
Summarize a skewed sample
Compare the midhinge with the mean and median when extreme observations make the center difficult to describe with one statistic.
Check statistical coursework
Verify a hand calculation while seeing the exact Q1 and Q3 values used under the stated quartile convention.
Automate descriptive reports
Add a deterministic midhinge field to recurring data summaries and preserve its method for reproducibility.
FAQ
What is the midhinge formula?
The midhinge equals (Q1 + Q3) / 2, where Q1 is the first quartile and Q3 is the third quartile.
Which quartile method does this calculator use?
It uses Tukey's exclusive-halves convention, excluding the overall median from both halves when the sample size is odd.
Is the midhinge the same as the median?
Not generally. The median uses the central position, while the midhinge averages the first and third quartiles; they coincide for many symmetric samples but can differ.
Can the array contain numeric strings or blanks?
No. Every element must be a finite number. Strings, blank values, null, Infinity, and NaN are rejected.
What happens with a single number?
Q1, Q3, and the midhinge all equal that one number, and the response reports a count of one.
What does an API request cost?
Each API request starts at $0.002. The calculation is also available through the browser implementation.
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/stat/midhinge \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"numbers":[2,4,6,8,10,12,14,16]}'const res = await fetch("https://api.kit.forhosting.com/stat/midhinge", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"numbers": [
2,
4,
6,
8,
10,
12,
14,
16
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/midhinge",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"numbers": [
2,
4,
6,
8,
10,
12,
14,
16
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/midhinge", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"numbers":[2,4,6,8,10,12,14,16]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"numbers":[2,4,6,8,10,12,14,16]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/midhinge", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"numbers": [
2,
4,
6,
8,
10,
12,
14,
16
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.midhinge",
"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. |