Percentile and Quartile Calculator
For 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 the median is 23, the quartiles are 17.75 and 29.5 and the interquartile range is 11.75, which makes 78 an outlier above the upper fence of 47.125. The 90th percentile is 34.6 and a value of 26 has a percentile rank of 62.5%. Quartile methods disagree: the same list gives Q1 = 17.25 and Q3 = 30.5 with the exclusive method (Excel QUARTILE.EXC) and 17.5 and 30 with the textbook median-of-halves method, so pick the method that matches your course or software, and see all three side by side below the box plot.
Updated Runs in your browser: nothing you enter is uploadedHow this tool works
12 numbers, linear method
Median 23, quartiles 17.75 and 29.5, IQR 11.75
Five-number summary: 12, 17.75, 23, 29.5, 78.
- Count
- 12
- Minimum
- 12
- First quartile (Q1)
- 17.75
- Median (Q2)
- 23
- Third quartile (Q3)
- 29.5
- Maximum
- 78
- Interquartile range (IQR)
- 11.75
- Lower fence (Q1 − 1.5 × IQR)
- 0.125
- Upper fence (Q3 + 1.5 × IQR)
- 47.125
- Outliers
- 78
- 90th percentile
- 34.6
- Percentile rank of 26
- 62.5%
- Outliers: 1 value above the upper fence.
- The 90th percentile sits at position 10.9 of 12 in the sorted list (1 + (n − 1) × k ÷ 100), 0.9 of the way from 31 to 35: 31 + 0.9 × (35 − 31) = 34.6.
- Of 12 values, 7 are below 26 and 1 equals it, so its percentile rank is (7 + ½ × 1) ÷ 12 × 100 = 62.5%.
Box plot
The same numbers by each method
The median is the same everywhere; the quartiles, fences, outliers and percentiles can differ.
| Measure | Linear | Exclusive | Median of halves |
|---|---|---|---|
| Median (Q2) | 23 | 23 | 23 |
| First quartile (Q1) | 17.75 | 17.25 | 17.5 |
| Third quartile (Q3) | 29.5 | 30.5 | 30 |
| Interquartile range (IQR) | 11.75 | 13.25 | 12.5 |
| Lower fence | 0.125 | −2.625 | −1.25 |
| Upper fence | 47.125 | 50.375 | 48.75 |
| Outliers | 78 | 78 | 78 |
| 90th percentile | 34.6 | 65.1 | Not defined |
Quartiles and outliers of seven example lists
| Numbers | Q1 | Median | Q3 | IQR | Outliers |
|---|---|---|---|---|---|
| 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 | 17.75 | 23 | 29.5 | 11.75 | 78 |
| 1, 2, 3, 4, 5 | 2 | 3 | 4 | 2 | None |
| 1, 2, 3, 4 | 1.75 | 2.5 | 3.25 | 1.5 | None |
| 10, 20, 30, 40, 1000 | 20 | 30 | 40 | 20 | 1,000 |
| 4, 8, 15, 16, 23, 42 | 9.75 | 15.5 | 21.25 | 11.5 | 42 |
| 2, 4, 4, 4, 5, 5, 7, 9 | 4 | 4.5 | 5.5 | 1.5 | 9 |
| 0.1, 0.2, 0.3, 0.4 | 0.175 | 0.25 | 0.325 | 0.15 | None |
How the three methods differ on the example
| Measure | Linear | Exclusive | Median of halves |
|---|---|---|---|
| Median (Q2) | 23 | 23 | 23 |
| First quartile (Q1) | 17.75 | 17.25 | 17.5 |
| Third quartile (Q3) | 29.5 | 30.5 | 30 |
| Interquartile range (IQR) | 11.75 | 13.25 | 12.5 |
| Lower fence | 0.125 | −2.625 | −1.25 |
| Upper fence | 47.125 | 50.375 | 48.75 |
| Outliers | 78 | 78 | 78 |
Percentiles of the example by method
| Percentile | Linear | Exclusive | Median of halves |
|---|---|---|---|
| 10th percentile | 15.2 | 12.9 | Not defined |
| 25th percentile | 17.75 | 17.25 | 17.5 |
| 50th percentile | 23 | 23 | 23 |
| 75th percentile | 29.5 | 30.5 | 30 |
| 90th percentile | 34.6 | 65.1 | Not defined |
| 95th percentile | 54.35 | Not defined | Not defined |
| 99th percentile | 73.27 | Not defined | Not defined |
Percentile rank of values in the example
| Value | Values below | Values equal | Percentile rank |
|---|---|---|---|
| 12 | 0 | 1 | ≈ 4.166667% |
| 17 | 2 | 1 | ≈ 20.833333% |
| 21 | 4 | 1 | 37.5% |
| 26 | 7 | 1 | 62.5% |
| 35 | 10 | 1 | 87.5% |
| 78 | 11 | 1 | ≈ 95.833333% |
Which method does your software use?
| Tool and setting | Method here | Q1 of the example |
|---|---|---|
| Excel PERCENTILE.INC and QUARTILE.INC (also the older PERCENTILE and QUARTILE) | Linear | 17.75 |
| Excel PERCENTILE.EXC and QUARTILE.EXC | Exclusive | 17.25 |
| NumPy np.percentile, default method="linear" | Linear | 17.75 |
| NumPy np.percentile, method="weibull" | Exclusive | 17.25 |
| R quantile(), default type = 7 | Linear | 17.75 |
| R quantile(), type = 6 | Exclusive | 17.25 |
| Python statistics.quantiles, default method="exclusive" | Exclusive | 17.25 |
| Python statistics.quantiles, method="inclusive" | Linear | 17.75 |
| Many textbooks: the median of the lower and upper half | Median of halves | 17.5 |
How to find quartiles and percentiles by hand
- Sort the numbers. Put the numbers in ascending order. 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 is already sorted and has 12 values.
- Find the position. For the linear method the p-th percentile sits at position 1 + (n − 1) × p ÷ 100 counting from 1. For Q1 (p = 25) of 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 that is 1 + 11 × 0.25 = 3.75; a fraction means Q1 lies between two of the values.
- Interpolate between the neighbours. Take the value at the lower position and add the fractional part times the gap to the next value: 17 + 0.75 × (18 − 17) = 17.75. Q3 works the same way and gives 29.5.
- Subtract for the IQR and build the fences. IQR = Q3 − Q1 = 29.5 − 17.75 = 11.75. The fences are Q1 − 1.5 × IQR = 0.125 and Q3 + 1.5 × IQR = 47.125; anything outside them is an outlier: 78.
- Find a percentile rank the other way round. Count the values below and equal to the value. For 26: Of 12 values, 7 are below 26 and 1 equals it, so its percentile rank is (7 + ½ × 1) ÷ 12 × 100 = 62.5%.
Frequently asked questions
- How do you calculate quartiles?
- Sort the numbers, then find the values a quarter, half and three quarters of the way through. With the default linear method (Excel QUARTILE.INC, NumPy’s default) Q1 sits at position 1 + (n − 1) ÷ 4 counting from 1, and Q3 at 1 + 3 × (n − 1) ÷ 4, and a fractional position is interpolated between its two neighbours. For 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 that gives Q1 = 17.75, the median 23 and Q3 = 29.5.
- Why do Excel, NumPy and my textbook give different quartiles?
- There is no single definition of a quartile for a finite list; Hyndman and Fan (1996) list nine common ones, and software picks different defaults. For 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 Q1 is 17.75 (linear), 17.25 (exclusive) or 17.5 (median of halves), and Q3 is 29.5, 30.5 or 30. The list 1, 2, 3, 4, 5 gives Q1 = 2 (linear), 1.5 (exclusive) and 1.5 (median of halves). The gap shrinks as the list grows. Use the selector to match the method your course or software uses.
- Which method should I use?
- Use the one your course, template or software uses, so that your answers match. If you are free to choose, linear (Excel PERCENTILE.INC, NumPy and R defaults) is the most widely available and is defined for every percentile from 0 to 100. The exclusive method suits larger samples where you do not want the 0th and 100th percentiles to be the minimum and maximum, but it has no value near the ends: it covers only ≈ 7.692308 to ≈ 92.307692 for the 12 values of the example, so the 99th percentile is not available (the calculator says “Not defined”). Median of halves is the usual classroom rule for quartiles only.
- What is the difference between a percentile and a percentile rank?
- A percentile turns a percentage into a value: the 90th percentile of 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78 is 34.6, the value with about 90% of the data at or below it. A percentile rank goes the other way and turns a value into a percentage: 26 has a percentile rank of 62.5%. The percentile rank here is the mid-rank version, (values below + half of the values equal) ÷ n × 100, the same as SciPy’s percentileofscore with kind="mean".
- How do I find the interquartile range and outliers?
- The interquartile range is Q3 − Q1, the spread of the middle half of the data: 11.75 for 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78. Tukey’s rule puts fences 1.5 × IQR below Q1 and above Q3 (0.125 and 47.125 here), and values beyond them are flagged as outliers: 78. A value exactly on a fence is not an outlier. Because quartiles depend on the method, the fences and sometimes the outliers do too.
- Should I delete the outliers the calculator finds?
- No, not automatically. The 1.5 × IQR rule flags values that are unusual compared with the middle half of the data; it does not say they are errors. Check whether the value is a typing mistake, a different kind of observation or a genuine extreme before leaving it out. Notice how little the quartiles move when an extreme value is added: 10, 20, 30, 40, 1000 has Q1 = 20 and Q3 = 40, so 1,000 is flagged without disturbing the box.
- What is a five-number summary and how do I read a box plot?
- The five-number summary is the minimum, Q1, median, Q3 and maximum: 12, 17.75, 23, 29.5, 78 for 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78. A box plot draws it: the box runs from Q1 to Q3, the line inside is the median, and the whiskers reach the lowest and highest values that lie within the fences, with dots for the outliers beyond them. So the whiskers stop at the last ordinary value, not at the minimum and maximum, whenever there are outliers.
- Why does the exclusive method say “Not defined” or “Needs at least 3 numbers”?
- The exclusive method puts the p-th percentile at position (n + 1) × p ÷ 100 counting from 1, and a position below 1 or above n would fall outside the data. That happens for p below 100 ÷ (n + 1) or above 100 × n ÷ (n + 1), so Excel’s PERCENTILE.EXC and QUARTILE.EXC return #NUM! there. For n = 2 the first quartile would sit at position 0.75, which is why the calculator answers “Needs at least 3 numbers” for the list 3, 9. NumPy’s weibull method clamps to the minimum or maximum in that case; this calculator follows Excel and says the value is not defined.
- Is the 50th percentile the median?
- Yes. The 50th percentile and the second quartile are the median, and all three methods agree on it: 23, 23, 23 for 12, 15, 17, 18, 21, 22, 24, 26, 29, 31, 35, 78. The 25th and 75th percentiles are Q1 and Q3, and the 100th percentile is the maximum for the linear method.
- How are tied values handled in a percentile rank?
- Ties count half. Of 6 values, 1 is below 3 and 3 equal it, so its percentile rank is (1 + ½ × 3) ÷ 6 × 100 = ≈ 41.666667%. Other definitions count only the values strictly below, or all values at or below; the working under the results shows both counts so you can use whichever your course defines.
- Do I need to sort the numbers first, and what can I paste?
- No, the calculator sorts them. You can paste up to 5,000 numbers separated by commas, spaces, tabs, semicolons or new lines, so a spreadsheet column works. A comma between groups of exactly three digits with no space (1,234) is one number; write 1, 234 with a space for two. Text that is not a number is ignored and listed, and anything beyond 5,000 numbers is left out with a note.
- Is the result exact, even for decimals?
- Yes. Every number is read as an exact decimal and every quartile, fence and percentile is computed as a fraction of whole numbers, so there is no floating-point drift. A result that ends within 12 decimals is shown in full; a longer one is rounded to 6 decimals and marked with ≈.
How it works
Numbers are read as exact decimals (no rounding on the way in), brought to a common scale, and sorted as whole numbers; every quantile is then an exact fraction. Linear (inclusive) method, Hyndman and Fan type 7: the p-th percentile sits at the zero-based position (n − 1) × p ÷ 100 and a fractional position is interpolated linearly between the two values around it (Excel PERCENTILE.INC and QUARTILE.INC, NumPy method="linear", R type 7). Exclusive method, type 6: the position is (n + 1) × p ÷ 100 counting from 1, defined only when it lies between 1 and n (Excel PERCENTILE.EXC and QUARTILE.EXC, NumPy method="weibull", R type 6); outside that range the calculator reports that the value is not defined, as Excel does. Median of halves: the sorted list is split at its median, the median itself belonging to neither half when n is odd, and Q1 and Q3 are the medians of the lower and upper half; this method defines the quartiles only. The median is the same for all three. The interquartile range is Q3 − Q1, the fences are Q1 − 1.5 × IQR and Q3 + 1.5 × IQR (Tukey’s rule), and a value strictly outside them is an outlier. The box plot’s whiskers end at the lowest and highest values inside the fences. The percentile rank of a value v is (number of values below v + half the number equal to v) ÷ n × 100, which equals SciPy’s percentileofscore with kind="mean". Results were checked against NumPy percentile values (linear and weibull) and SciPy percentileofscore values on several lists. Display rule: a result that ends within 12 decimals is shown in full, anything longer is rounded half away from zero to 6 decimals and marked ≈. Everything is computed on your device, in your browser, from the numbers on the page.
Sources
- Hyndman, R. J. and Fan, Y. (1996), Sample quantiles in statistical packages, The American Statistician 50(4), 361–365
- NumPy documentation: numpy.percentile (the method parameter)
- Python documentation: statistics.quantiles
- Microsoft Excel documentation: PERCENTILE.INC, PERCENTILE.EXC, QUARTILE.INC and QUARTILE.EXC
- NIST/SEMATECH e-Handbook of Statistical Methods
- NIST/SEMATECH e-Handbook, 1.3.5.6 Measures of Scale (interquartile range)
- Quantile, Wikipedia
- Percentile, Wikipedia
- Interquartile range, Wikipedia
- Box plot, Wikipedia
More free tools
- Test Grade CalculatorEnter total questions or points and the number wrong or right: get the percentage, the letter grade and a grading chart for every number wrong.
- Final Grade CalculatorFind the score you need on the final exam to reach the grade you want, from your current grade and the final’s weight, or from weighted categories.
- GPA CalculatorWork out your GPA from credits and letter grades or percentages: unweighted, weighted (Honors, AP/IB), cumulative, and the GPA you need next.
- Weighted Grade CalculatorWork out your grade from categories with weights, such as homework 20%, quizzes 30% and exam 50%, and see what you need on the part still to come.
- Chi-Square CalculatorChi-square test of independence or goodness of fit from your counts: statistic, p-value, expected counts, Cramér’s V and critical values at your alpha.
- Average CalculatorFind the average (mean), median, mode and range of any list of numbers, plus standard deviation and a weighted average. Paste a column from a spreadsheet.
More: Statistics, probability and gradesAll math & numbersAll toolsHome & DIY calculators