Decile calculator
Nine cut points split your data into ten equal portions: D1 marks the lowest 10 %, D5 sits at the median and D9 at 90 %. See where a salary or a score falls in the distribution without working out nine separate percentiles. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
This decile calculator turns an array of numbers into the nine boundaries that divide its ordered distribution into ten equal portions. It validates every value, sorts a copy of the data, and calculates D1 through D9 with inclusive linear interpolation. The result makes it easy to compare observations with the lower, middle, and upper tenths of a sample without requesting nine separate percentiles. The original order is not modified, and an empty array is rejected clearly.
What the nine deciles describe
Deciles are position markers in an ordered data set. D1 marks the point associated with the first ten percent of the distribution, D2 with twenty percent, and the sequence continues through D9 at ninety percent. Together, these nine values create ten bands that contain approximately equal shares of the observations.
They are useful when a single average hides the shape of the data, especially when results are skewed or contain a long tail. A salary analyst, for example, can use the deciles to see how compensation changes across the workforce rather than reducing everyone to one mean. The calculator returns every boundary in ascending order, so the first item is D1 and the ninth item is D9.
It also returns the sorted values and their count, making the calculation easy to inspect. Deciles describe relative position within the submitted sample; they do not claim that the distance between neighboring boundaries will be equal. Wide or narrow gaps are meaningful features of the observed distribution.
How linear interpolation is applied
The calculation first validates that the input is a nonempty array containing only finite JavaScript numbers. It then sorts a copy from smallest to largest. For each decile number k from one through nine, the calculator locates the fractional zero-based index (k divided by ten) multiplied by (n minus one), where n is the number of observations.
When that index is a whole number, the value at that position is returned directly. When it falls between two positions, the result is interpolated proportionally between the lower and upper values. This inclusive linear convention makes D1 equivalent to the tenth percentile, D5 equivalent to the median under the same convention, and D9 equivalent to the ninetieth percentile.
Duplicate values are retained because each observation contributes to position. Negative values and decimals work normally. NaN, Infinity, strings, nulls, and other nonnumeric entries are rejected instead of being silently converted, so an apparently valid result cannot conceal malformed source data.
How to interpret and use the result
Read the returned deciles as boundaries, not as ten separate averages. A value below D1 lies in the lowest portion of the submitted distribution, while a value above D9 lies in its highest portion. Values between D4 and D5 occupy the band bounded by those two markers.
With small samples, interpolation can place a boundary between observed values; this is expected and does not mean the calculated number appeared in the original array. Because published tools and statistical packages support several quantile conventions, record the method whenever results will be compared across systems. This capability identifies its method as linear and includes the sorted sample for auditability.
Use a representative sample when drawing operational conclusions: deciles faithfully summarize the supplied numbers but cannot repair selection bias, missing records, or incompatible measurement units. Before submitting, normalize units and decide whether repeated observations are legitimate.
What you can do with it
Segment performance results
Create ten score bands for a class, campaign, or operational metric without calculating each percentile separately.
Review income distribution
Compare lower, middle, and upper tenths of a salary or revenue sample while preserving the distribution's shape.
Set monitoring thresholds
Use historical decile boundaries as transparent reference points for unusually low or high observations.
FAQ
What does the calculator return?
It returns an ordered array containing D1 through D9, plus the method, observation count, and sorted data used for the calculation.
Which decile method is used?
It uses inclusive linear interpolation at positions (k/10) × (n−1) for k from 1 through 9.
Is D5 the median?
Yes. Under this linear interpolation convention, D5 is the fiftieth percentile and therefore the median.
Are duplicate and negative values allowed?
Yes. Duplicate, negative, zero, and decimal values are accepted as long as every entry is a finite number.
How do I tell which tenth a value falls in?
Read the deciles as boundaries, not averages. A value below D1 lies in the lowest tenth of your sample, a value between D4 and D5 in the fifth tenth, and a value above D9 in the top tenth.
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/stat/deciles \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"values":[12,7,3,18,10,5,14,1,16,9]}'const res = await fetch("https://api.kit.forhosting.com/stat/deciles", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"values": [
12,
7,
3,
18,
10,
5,
14,
1,
16,
9
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/deciles",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"values": [
12,
7,
3,
18,
10,
5,
14,
1,
16,
9
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/deciles", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"values":[12,7,3,18,10,5,14,1,16,9]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"values":[12,7,3,18,10,5,14,1,16,9]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/deciles", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"values": [
12,
7,
3,
18,
10,
5,
14,
1,
16,
9
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.deciles",
"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
How to interpret and use the result
The endpoint costs $0.002 per request when automated, and the deterministic implementation returns the same output for the same numeric array regardless of its original ordering.
Technical questions
What happens with an empty array?
The request fails with an invalid_input error because no decile boundary can be calculated without observations.
How much does an API calculation cost?
Each automated request costs $0.002.