Home › Statistics & Probability › Percentile Calculator
Percentile Calculator
For a list of numbers, computes the value at a given percentile (linear interpolation, as in Excel PERCENTILE.INC) and/or the percentile rank of a given value (percentage of values below it, counting ties as half).
When to use
You need the k-th percentile of a data set (e.g. the 90th percentile response time) or want to know what percentile a particular value falls at within the data.
Do not use when: You want a percentile from a normal distribution rather than actual data (use z-score or normal-distribution), or you need quartiles together with other summary statistics (use descriptive-statistics).
Formula
value at percentile p: rank = p/100 · (n − 1) on the sorted data, value = x(⌊rank⌋) + (rank − ⌊rank⌋) · (x(⌊rank⌋+1) − x(⌊rank⌋)); percentile rank of v = 100 · (count(x < v) + 0.5 · count(x = v)) / n
The value-at-percentile method is Hyndman & Fan type 7 (Excel PERCENTILE.INC, R and NumPy default); the 'exclusive' method and nearest-rank method give different results for small n. Percentile rank uses the definition with ties counted as half.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
values | number_list | yes | The data set (order does not matter). | |
percentile | number | % | no | Percentile between 0 and 100 whose value you want (e.g. 90 for the 90th percentile). Give this, value, or both. Range: ≥ 0, ≤ 100 |
value | number | no | A value whose percentile rank within the data you want. Give this, percentile, or both. |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
value_at_percentile | number | Data value at the requested percentile by linear interpolation between sorted values (only when percentile is given). | |
percentile_rank | number | % | 100 × (count below + 0.5 × count equal) / n (only when value is given). |
count_below | integer | Number of data values strictly less than value. | |
count_equal | integer | Number of data values equal to value. | |
count | integer | Size of the data set. |
Example
40th percentile of 15, 20, 35, 40, 50: {"values":[15,20,35,40,50],"percentile":40} → {"value_at_percentile":29,"count":5}
Rank of 5 and 90th percentile in 2, 4, 4, 4, 5, 5, 7, 9: {"values":[2,4,4,4,5,5,7,9],"value":5,"percentile":90} → {"percentile_rank":62.5,"count_below":4,"count_equal":2,"value_at_percentile":7.6,"count":8}
GET https://tttkmbb.com/api/v1/calculate/percentile?values=15%2C20%2C35%2C40%2C50&percentile=40
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/percentile(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/percentile · Markdown: https://tttkmbb.com/statistics/percentile.md · JSON definition: https://tttkmbb.com/statistics/percentile.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="percentile" - OpenAPI operationId:
calculate_percentile - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Percentile (reference)
- Wikipedia – Percentile rank (reference)
- Microsoft Support – PERCENTILE.INC function (reference)
FAQ
Why does Excel give a different number?
PERCENTILE.INC matches this calculator; PERCENTILE.EXC uses rank = p·(n + 1) and is undefined near the ends. Some textbooks use the nearest-rank method, which always returns an actual data value.
How are ties handled in the percentile rank?
Values equal to the query count as half below and half above, so the rank of the median of a symmetric data set is 50 %. A value below the minimum has rank 0 and above the maximum rank 100.
Related calculators
- Descriptive Statistics Calculator — Quartiles, median and spread of the same data.
- Z-Score Calculator — Percentile under a normal distribution from mean and SD.