Skip to main content
v2026.11,858 entries · CC-BY 4.0

Percentile and Quantile: Difference, Formula and Worked Example

A percentile is a quantile on a 0–100 scale. Formula, why methods disagree (42.7 vs 56.3), and Excel, R and Python code.

Written and maintained by CASRAI Editorial Board

Last updated

A quantile is a cut point described by a proportion between 0 and 1, and a percentile is the same cut point described on a 0 to 100 scale, so the 0.9 quantile and the 90th percentile are the same number. The practical trap is the scale: R, NumPy’s quantile function and Excel’s PERCENTILE.INC all take a proportion, and passing 90 instead of 0.9 either fails or answers a different question. A second trap is that the value itself depends on the estimation method, so the same 10 numbers give a 90th percentile of 42.7 under one rule and 56.3 under another. This page shows both calculations with the arithmetic.

Definition: percentile and quantile in one paragraph

The NIST/SEMATECH e-Handbook of Statistical Methods defines the pth percentile as a value, Y(p), such that at most 100p % of the measurements are less than this value, with p written as a fraction, and notes that the 50th percentile is called the median. A quantile is the same idea indexed by the proportion p itself: the p-quantile of a sample is the value that has about a share p of the data at or below it. R’s documentation states that its quantile function “produces sample quantiles corresponding to the given probabilities”, and NumPy documents that percentile with q behaves as quantile with q/100. In short, percentile = quantile × 100 for the same cut point. Named families such as quartiles (quarters) and deciles (tenths) are special cases; for the quartile case see percentile vs quartile.

Percentile vs quantile: the 0–1 scale against the 0–100 scale

Percentile and quantile are not two different statistics. They are one statistic written on two scales, and software follows one scale or the other regardless of the function’s name. Excel is the clearest example: PERCENTILE.INC is named after percentiles, but Microsoft’s documentation says it “returns the k-th percentile of values in a range, where k is in the range 0 to 1, inclusive”, and it returns #NUM! if the array is empty or k is below 0 or above 1.

Tool and function Argument scale For the 90th percentile pass
Excel PERCENTILE.INC(array, k) k from 0 to 1 inclusive 0.9
R stats::quantile(x, probs) probs in [0, 1] 0.9
NumPy numpy.quantile(a, q) q between 0 and 1 inclusive 0.9
NumPy numpy.percentile(a, q) q in [0, 100] 90

Quantile and percentile: which word to use

Use “percentile” when the audience reads results as percentages (test scores, growth charts, payline ranks) and “quantile” when you are writing code, working with probabilities or discussing the general method. In a methods section, name the proportion once and the equivalent percentile once, for example “the 0.9 quantile (90th percentile)”.

Quantile and percentile formula, every symbol explained

For a sample sorted from smallest to largest, x(1) ≤ x(2) ≤ … ≤ x(n), R’s documentation gives the general form of a sample quantile as an interpolation between two neighbouring ordered values:

Q(p) = (1 − γ) · x(j) + γ · x(j+1), with j = floor(np + m) and g = np + m − j.

  • Q(p) is the sample quantile for proportion p (p = 0.9 is the 90th percentile).
  • n is the number of observations.
  • x(j) and x(j+1) are the j-th and (j+1)-th smallest values.
  • g is the fractional part left over after taking the whole number j.
  • γ is the interpolation weight; for the default method, type 7, γ = g and m = 1 − p.
  • m is a constant chosen by the method, and it is the only thing that differs between the nine R types.

R’s default is type 7, the method used by S and by R before version 2.0.0, and the nine types are selected with the type argument; they are catalogued in Hyndman and Fan (1996). NumPy’s default method is ‘linear’, and NIST’s handbook gives the same two rules as R6 and R7. Rule R6 sets p(N + 1) equal to k + d and takes Y(p) = Y[k] + d(Y[k+1] − Y[k]). Rule R7 sets 1 + p(N − 1) equal to k + d and uses the same interpolation; the handbook calls R7 the method used by Excel.

Worked example: one sample, two methods

Take n = 10 values, already sorted: 12, 15, 17, 20, 22, 25, 31, 34, 41, 58 (a made-up illustration, not real data). We want the 0.25 quantile (25th percentile) and the 0.9 quantile (90th percentile).

The 0.25 quantile

  • Method R7 (R default, NumPy ‘linear’, Excel PERCENTILE.INC): position = 1 + p(N − 1) = 1 + 0.25 × 9 = 3.25, so k = 3 and d = 0.25. Y = 17 + 0.25 × (20 − 17) = 17.75.
  • Method R6 (NIST’s default rule, R type 6): position = p(N + 1) = 0.25 × 11 = 2.75, so k = 2 and d = 0.75. Y = 15 + 0.75 × (17 − 15) = 16.5.

The 0.9 quantile

  • R7: position = 1 + 0.9 × 9 = 9.1, so k = 9 and d = 0.1. Y = 41 + 0.1 × (58 − 41) = 42.7.
  • R6: position = 0.9 × 11 = 9.9, so k = 9 and d = 0.9. Y = 41 + 0.9 × (58 − 41) = 56.3.

The two methods agree at the median (both give 23.5, the average of 22 and 25) and disagree most near the tails of a small sample, which is why the 90th percentile moves by more than 13 units here. With hundreds of observations the gap shrinks to almost nothing. Neither answer is wrong; they are different estimators of the same population quantity. The NIST handbook’s percentile rules and the Excel statement above are the reason a spreadsheet and a statistics package can disagree on the same data. To go the other way, from a value to its percentile rank, see how to calculate percentile from rank.

Interpretation: what the number tells you

Statement How to read it
The 0.5 quantile The 50th percentile, which NIST calls the median.
A value at the 90th percentile At most 10 % of the measurements are greater than it (the NIST definition run from the top).
Quantile of 0 or 1 Excel and NumPy both accept 0 and 1; under the linear rule (R7) these return the smallest and largest observation.
Difference between two quantiles A spread measure; see the interpercentile range and the interquartile range.

A percentile is a position, not a score. Knowing that a value sits at the 90th percentile says nothing about how far it is from the rest of the data. To check whether a whole sample follows an assumed distribution by comparing its quantiles to theoretical ones, see the Q-Q plot guide.

Assumptions and common mistakes

  • Passing 90 where 0.9 is expected. In Excel PERCENTILE.INC the result is #NUM!, because k must lie between 0 and 1. In R, probs outside [0, 1] is an error. NumPy’s quantile requires values between 0 and 1.
  • Not stating the method. The same data and the same p give different answers by method (16.5 and 17.75 above), so a result is only reproducible if the method is named.
  • Treating a sample quantile as the population value. The NIST definition describes the percentile of a set of measurements; a sample estimate carries sampling error, and small samples make that error large.
  • Using a percentile of a tiny sample. With 10 values, the 90th percentile is an interpolation between the top two observations.
  • Mixing up percentile and percentile rank. A percentile maps a proportion to a value; a percentile rank maps a value to a proportion.

How to report it

State the proportion, the percentile equivalent, the value and the estimation method. A report-ready sentence from the example:

The 90th percentile (0.9 quantile) of the 10 observations was 42.7, estimated by linear interpolation (R type 7; Hyndman and Fan, 1996).

Naming the method is good practice here rather than a published requirement of a particular style manual. When quartiles or percentiles accompany a median, see how to report a median and interquartile range.

How to calculate it in Excel, R or Python

All three snippets use the 10 values above and return 42.7 for the 90th percentile.

Excel (values in A1:A10; note the 0–1 argument):

=PERCENTILE.INC(A1:A10, 0.9)

R (type 7 is the default; type = 6 gives the NIST R6 rule):

x = c(12, 15, 17, 20, 22, 25, 31, 34, 41, 58)
quantile(x, probs = 0.9)            # 42.7
quantile(x, probs = 0.9, type = 6)  # 56.3

Python (NumPy):

import numpy as np
x = [12, 15, 17, 20, 22, 25, 31, 34, 41, 58]
np.quantile(x, 0.9)                   # 42.7  (q on 0 to 1)
np.percentile(x, 90)                  # 42.7  (q on 0 to 100)
np.quantile(x, 0.9, method='weibull') # 56.3  (R type 6)

FAQ

Is a percentile a quantile?

Yes. A percentile is a quantile expressed on a 0 to 100 scale, and NumPy documents that numpy.percentile with q is the same as numpy.quantile with q/100.

Is a quartile a quantile?

Yes. The quartiles are the 0.25, 0.5 and 0.75 quantiles, which are the 25th, 50th and 75th percentiles. See percentile vs quartile.

Why do Excel, R and other tools give different percentiles?

They can use different estimation rules. R’s default is type 7, and NIST says Excel uses its R7 method; NIST’s own default rule is R6, so a NIST-style calculation and a spreadsheet can differ on small samples.

How do I convert a percentile to a quantile?

Divide by 100: the 95th percentile is the 0.95 quantile. To go back, multiply by 100.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Percentile and Quantile: Difference, Formula and Worked Example

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.