gizmobench

Quartile Calculator

Paste a list and this returns the five-number summary, the interquartile range and the 1.5 x IQR fences, with the convention that produced the numbers printed beside them. That last part is the whole point. Quartiles are not one definition: on 1, 2, 3, 4, 5, 6, 7, 8 the median of halves taught in school gives Q1 2.5 and Q3 6.5, and the R7 interpolation that Excel, NumPy and R use by default gives 2.75 and 6.25, so the interquartile range is 4 under one and 3.5 under the other. Both are correct under the rule that produced them. Four conventions are offered here, median of halves, Tukey hinges, R7 and R6, the working shows how the quartile was reached, and a table under the tool puts all four answers to your own numbers side by side. Values outside the fences are listed and drawn as separate points on the box plot, and they stay in the data: nothing is deleted and no statistic is quietly recomputed without them. Up to 10,000 values at a time, nothing uploaded, no account.

8 valuesMedian of halvesFive-number summary1.5 x IQR fences
convention     median of halves, odd centre excluded
data sorted    1  2  3  4  |  5  6  7  8
method         Q1 is the median of the lower 4, Q3 the median of the upper 4.

min 1    Q1 2.5    median 4.5    Q3 6.5    max 8
IQR            6.5 - 2.5  =  4
fences         -3.5  and  12.5

same data under R7 linear interpolation at (n - 1)p
Q1 2.75    Q3 6.25    IQR 3.5
18
Q1
2.5
Median
4.5
Q3
6.5
IQR
4

Box plot on an axis from 1 to 8. Whisker at 1, box from 2.5 to 6.5 with the median at 4.5, whisker at 8. No value is outside the fences.

Quartile convention
What to put first

The minimum, Q1, the median, Q3 and the maximum, with the fences underneath.

Under median of halves, odd centre excluded, 8 values give min 1, Q1 2.5, median 4.5, Q3 6.5 and max 8, an interquartile range of 4.

Commas, spaces, tabs, semicolons and new lines all separate values, so a column copied from a spreadsheet pastes straight in, and up to 10,000 values are read at a time. Figures on screen are rounded to six decimal places; the arithmetic itself keeps full double precision. Nothing you type leaves this browser.

Worked examples

  • 1 to 8, median of halveseven count, halves are clean
    Q1 2.5, median 4.5, Q3 6.5, IQR 4
  • Same data under R7linear interpolation
    Q1 2.75, median 4.5, Q3 6.25, IQR 3.5
  • 1, 2, 3, 4, 5, 6, 7, 100the fences decide
    Fences -3.5 and 12.5: 100 listed outside, kept in the data

Where the conventions disagree

The same 8 values under all four conventions. They agree on the median, always. Where they differ, it is on Q1 and Q3.

Q1, median, Q3 and IQR under each quartile convention
ConventionQ1MedianQ3IQR
Median of halves (on screen)2.54.56.54
Tukey hinges2.54.56.54
R7 interpolation2.754.56.253.5
R6 interpolation2.254.56.754.5
The convention on screen. Split the sorted data at the median, then take the median of each half. When the count is odd the middle value goes in neither half. Moore and McCabe, the TI-83 and TI-84, and most school textbooks.
Why two calculators disagree. On 1, 2, 3, 4, 5, 6, 7, 8 the median of halves gives Q1 and Q3 of 2.5 and 6.5, an IQR of 4, while R7 interpolation gives 2.75 and 6.25 and an IQR of 3.5. Both are right under the convention that produced them, so the one to use is the one your course, your journal or your software uses. The table above shows all four on your own numbers.
Accuracy. Exact arithmetic under the quantile convention you pick, and the page names which convention produced the numbers on screen, because median of halves and R7 genuinely disagree on the same eight values. Observations outside the 1.5 x IQR fences are listed and never deleted, and the page does not call them mistakes.

Common questions

Why do two quartile calculators disagree, and which convention is right?
Because they use different quantile conventions, and both are right under their own rule. On 1, 2, 3, 4, 5, 6, 7, 8 the median of halves gives Q1 2.5 and Q3 6.5, so the IQR is 4. R7 interpolation, the method behind Excel QUARTILE, NumPy percentile and the R default, puts Q1 at position 2.75 of 8 and lands on 2.75 and 6.25, so the IQR is 3.5. R6, which Excel QUARTILE.EXC and Minitab use, gives 2.25 and 6.75. The convention is a control on this page and its full name is printed with every figure, so you can tell which answer you are holding.
How do I find Q1 and Q3 by hand?
Sort the values, find the median, then take the median of each half. On 1, 2, 3, 4, 5, 6, 7, 8 the halves are 1, 2, 3, 4 and 5, 6, 7, 8, so Q1 is 2.5, Q3 is 6.5 and the median is 4.5. When the count is odd the middle value goes in neither half under the method most textbooks teach, and it is counted in both halves under Tukey hinges: on 1 to 9 that is the difference between Q1 2.5 and Q1 3. The working panel prints the split and says which of the two it used.
Which quartile convention does my course or my software use?
Excel QUARTILE and QUARTILE.INC, NumPy percentile, pandas quantile and the R default are R7. Excel QUARTILE.EXC and Minitab are R6. The TI-83 and TI-84, Moore and McCabe, and most school textbooks use the median of halves with the middle value excluded. The fivenum() function in R reports Tukey hinges. Pick the one that matches the tool you are being marked against, and the table under the calculator shows what the other three would have said about the same numbers.
What is the interquartile range, and what is it for?
The IQR is Q3 minus Q1: the width of the middle 50% of the data. On 1 to 8 under the median of halves it is 6.5 minus 2.5, which is 4. It describes spread without letting one distant value stretch it the way a range or a standard deviation can, which is why it is the basis of the usual outlier rule and of the box in a box plot. Switching this page to the interquartile range view puts that figure first, and the shaded box on the plot is exactly that middle 50%.
How does the 1.5 x IQR outlier rule work here?
The fences are Q1 minus 1.5 times the IQR and Q3 plus 1.5 times the IQR, and every value outside them is listed. On 1, 2, 3, 4, 5, 6, 7, 100 the quartiles under the median of halves are 2.5 and 6.5, so the IQR is 4 and the fences are -3.5 and 12.5: 100 falls outside and is named. The whiskers on the plot stop at the last value inside each fence, which is 7 here, and the flagged value is drawn as its own point.
Does this tool delete outliers from my data?
No. A flagged value is still counted, still sorted, still in the minimum or maximum, and still part of the quartiles themselves. The fence rule says a value sits far from the middle of this list, and that is all it can say: whether it is a measurement fault, a rare event or the interesting part of the data is a question about the data, not about the arithmetic. Nothing here calls it a mistake and nothing removes it for you.
What can I paste, and how many values?
Commas, spaces, tabs, semicolons and new lines all separate values, so a column copied from a spreadsheet works as it is. Negative numbers, decimals, exponent notation such as 1e3, currency symbols and a value in brackets for a negative are all read. Two values is the minimum and 10,000 is the maximum in one go. Anything that is not a number is named in a message rather than dropped quietly, so the summary always covers the whole list.
Can I copy the result, and does anything I paste leave my browser?
The Copy button puts the whole answer on the clipboard as tab separated rows: n, the minimum, Q1, the median, Q3, the maximum, the IQR, the range, both fences, the values outside them, all four conventions in a small table, and then the sorted list, which pastes straight into a spreadsheet. The calculation itself runs in this page. The only copy kept anywhere is the draft this browser remembers so your list is still there when you come back, and Start over, above the tool, forgets it.

Exact arithmetic under the quantile convention you pick, and the page names which convention produced the numbers on screen, because median of halves and R7 genuinely disagree on the same eight values. Observations outside the 1.5 x IQR fences are listed and never deleted, and the page does not call them mistakes.