Skip to content
MasterMath

Percentile and Quartile Calculator

Percentiles and quartiles of a list of values, with a table of the usual percentiles. It uses linear interpolation, the most widespread method and the one spreadsheets use.

Percentile requested

—

Percentile requested—
First quartile (P25)—
Median (P50)—
Third quartile (P75)—
Interquartile range—
Number of values—
PercentileValue

How this was worked out

    The formula

    Position = (n − 1) × p / 100, interpolating between the two values around it

    What it means

    The pth percentile is the value below which p per cent of the data fall. Quartiles are three specific percentiles: the 25th, the 50th — which is the median — and the 75th, and between the first and the third sits the middle half of the data. When the position lands between two values something has to be decided, and here it is interpolated: you take the matching fraction between the value below and the one above.

    How to work it out by hand

    1. Sort the values from smallest to largest
    2. Work out the position: (n − 1) × p ÷ 100, counting from zero
    3. If the position is a whole number, the percentile is that value
    4. If not, interpolate between the value before and the one after using the decimal part

    What is worth knowing

    There are at least nine different ways to compute percentiles and none of them is the correct one: they differ in what to do when the position falls between two values. Linear interpolation is what Excel's PERCENTILE.INC, Google Sheets and Python's numpy use by default, so it is the one most likely to match whatever you are being asked for. With large samples the methods barely differ; with six values they can differ noticeably.

    Frequently asked questions

    Is the 50th percentile the median?

    Yes, they are the same thing by definition: the value with half the data on each side.

    Why does my textbook give a different answer?

    Because there are several methods. This one uses linear interpolation, the same as Excel and Python, but a textbook may use another.

    What is the interquartile range?

    The distance between the third quartile and the first: the width of the middle half of the data.

    Can I ask for the 0th or the 100th percentile?

    Yes: they are the minimum and the maximum of the list.

    Do quartiles split the data into four equal parts?

    Into four parts with the same number of values, yes; with the same width, no. The outer parts are usually much wider.