HomeStatistics & 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

ParameterTypeUnitRequiredDescription
valuesnumber_listyesThe data set (order does not matter).
percentilenumber%noPercentile between 0 and 100 whose value you want (e.g. 90 for the 90th percentile). Give this, value, or both. Range: ≥ 0, ≤ 100
valuenumbernoA value whose percentile rank within the data you want. Give this, percentile, or both.

Outputs

OutputTypeUnitDescription
value_at_percentilenumberData value at the requested percentile by linear interpolation between sorted values (only when percentile is given).
percentile_ranknumber%100 × (count below + 0.5 × count equal) / n (only when value is given).
count_belowintegerNumber of data values strictly less than value.
count_equalintegerNumber of data values equal to value.
countintegerSize 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

Sources

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