Quartile Calculator

Quartile Calculator

Paste a list of numbers to get Q1, the median and Q3, the interquartile range and the five number summary, with 1.5 × IQR fences, outliers and a box plot drawn to scale. Every common quartile method is worked out side by side, so you can match your textbook, calculator or spreadsheet.

Separate with commas, spaces or new lines, or paste a spreadsheet column. Leave out thousands separators: 1,200 reads as 1 and 200.

Every figuretap a card to copy its value
Your data in order
between Q1 and Q3outside the box, inside the fencesoutlier, beyond 1.5 × IQRextreme, beyond 3 × IQR

Box plot, drawn to scale

Every quartile method compared

Median of halves splits the sorted data at the median and takes the median of each half; Tukey’s hinges keep the median in both halves when n is odd. The other methods interpolate at position h = (n − 1)p + 1 for QUARTILE.INC, (n + 1)p for QUARTILE.EXC or (n + 1/3)p + 1/3 for type 8. Fences: Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. The CSV, image and printed report contain the values you entered, nothing preloaded.

How to use this tool

Type or paste your numbers in any order, separated by commas, spaces, tabs or new lines, so a spreadsheet column can go straight in. Results update as you type, down to a box plot drawn to scale and a table repeating the calculation by five methods. The optional label appears in the result text and the shared link.

The setting people most often get wrong is the quartile method. To match a textbook, a TI calculator or a homework checker, leave it on median of halves. To match Excel choose QUARTILE.INC, which the older QUARTILE function also returns; to match Minitab or the NIST handbook choose QUARTILE.EXC. And leave out thousands separators: 1,200 is read as two numbers, so check that n is what you expect.

What the calculation is doing

Quartiles cut sorted data into four groups of roughly equal size. The median, or Q2, is the middle value, or the mean of the middle two. Q1 has about a quarter of the values below it and Q3 about three quarters, and “about” is the problem: with 13 values a quarter is 3.25 values.

The halves methods split the sorted list at the median and take the median of each half. When n is odd, the median of halves method used by TI calculators and the US Common Core leaves the middle value out of both halves; Tukey’s hinges, from the original box plot, put it into both. The interpolation methods instead find a position h in the sorted list: h = (n − 1)p + 1 for Excel’s QUARTILE.INC and R’s default, (n + 1)p for QUARTILE.EXC, Minitab and the NIST handbook, and (n + 1/3)p + 1/3 for type 8, with p = 0.25 for Q1 and 0.75 for Q3. At h = 3.75 the quartile is three quarters of the way from the 3rd value to the 4th; other values of p give percentiles.

The interquartile range is IQR = Q3 − Q1. The fences sit 1.5 × IQR below Q1 and above Q3, and values beyond them are outliers; beyond 3 × IQR, the NIST handbook’s outer fences, they are extreme. A box plot runs its whiskers to the most extreme values inside the fences and plots anything beyond as a point.

Left, five box plots of the same 12 commute times drawn on one scale from 10 to 55 minutes, one for each quartile method: median of halves and Tukey hinges give Q1 17.5 and Q3 27.5 with a fence at 42.5, QUARTILE.INC gives 17.75 and 26.75 with a fence at 40.25 so both 41 and 52 are outliers, QUARTILE.EXC gives 17.25 and 28.25 with a fence at 44.75, and type 8 gives 17.4167 and 27.75 with a fence at 43.25; right, a normal curve with its box plot underneath, Q1 and Q3 at 0.674 standard deviations either side of the mean, fences at 2.698, and 0.35% of the population beyond each fence
The methods move Q1 by only half a minute, yet that is enough to decide whether 41 counts as an outlier. A value that sits near a fence deserves a look whichever method drew the plot.

Why the methods disagree, and what the fences are for

A sample quartile estimates a quartile of the population, and there is no single right way to place a quarter point between two data values. Hyndman and Fan catalogued nine definitions used by statistical software in 1996. QUARTILE.INC treats the smallest and largest values as the 0th and 100th percentiles; QUARTILE.EXC places the kth of n values at k/(n + 1), allowing for population values beyond the sample. Hyndman and Fan preferred type 8, which is roughly median unbiased for any distribution.

For the default commute times, Q1 runs from 17.25 to 17.75 and the IQR from 9 to 11 depending on the method. The gap never exceeds one step between neighbouring sorted values, so it fades as the data grow. For odd n there is a tidy pattern: median of halves always matches QUARTILE.EXC, and Tukey’s hinges always match QUARTILE.INC.

The 1.5 × IQR fence is John Tukey’s rule of thumb. On normal data, Q1 and Q3 sit 0.674 standard deviations either side of the mean, so the IQR is 1.349 standard deviations and the fences land 2.698 out. Only 0.70% of a normal population lies beyond them, and about 2 in a million beyond 3 × IQR.

That 0.70% applies to each value, not to the sample. In 20,000 simulated normal samples of 100, about half had at least one outlier by the rule, and samples of 1,000 almost always did, around 7 each. With only 9 values the method matters as much as the data: Tukey’s hinges flagged an outlier in 30% of samples, the median of halves in 8%. Treat an outlier as a value to check, especially before a mean or a linear regression, which one extreme value can move a long way.

Quartiles of 1 to n under each method

Q1 and Q3 for the whole numbers 1 to n, a pattern that repeats every four values, as Langford showed in the Journal of Statistics Education. To find out which method a textbook or program uses, give it 1 to 8 and compare with that row.

DataMedian of halvesTukey’s hingesQUARTILE.INCQUARTILE.EXCType 8
1 to 41.5, 3.51.5, 3.51.75, 3.251.25, 3.751.42, 3.58
1 to 51.5, 4.52, 42, 41.5, 4.51.67, 4.33
1 to 62, 52, 52.25, 4.751.75, 5.251.92, 5.08
1 to 72, 62.5, 5.52.5, 5.52, 62.17, 5.83
1 to 82.5, 6.52.5, 6.52.75, 6.252.25, 6.752.42, 6.58
1 to 92.5, 7.53, 73, 72.5, 7.52.67, 7.33
1 to 103, 83, 83.25, 7.752.75, 8.252.92, 8.08
1 to 113, 93.5, 8.53.5, 8.53, 93.17, 8.83
1 to 123.5, 9.53.5, 9.53.75, 9.253.25, 9.753.42, 9.58

A worked example you can check on paper

Take the default commute times, sorted: 12, 15, 17, 18, 20, 21, 22, 24, 26, 29, 41 and 52 minutes. With n = 12 the median is (21 + 22) ÷ 2 = 21.5. By the median of halves, the lower half is 12 to 21, so Q1 = (17 + 18) ÷ 2 = 17.5, and the upper half is 22 to 52, so Q3 = (26 + 29) ÷ 2 = 27.5. The IQR is 10.

The fences are 17.5 − 1.5 × 10 = 2.5 and 27.5 + 1.5 × 10 = 42.5. 52 is above 42.5 but inside the outer fence of 57.5, so it is an outlier but not an extreme one, and the upper whisker stops at 41. The mean, 297 ÷ 12 = 24.75, sits 3.25 above the median. The 90th percentile by the (n + 1)p rule is at position 13 × 0.9 = 11.7, so it is 41 + 0.7 × (52 − 41) = 48.7.

Switch to QUARTILE.INC and Q1 sits at position 11 × 0.25 + 1 = 3.75, so Q1 = 17 + 0.75 × (18 − 17) = 17.75; Q3 at 9.25 gives 26 + 0.25 × (29 − 26) = 26.75. The IQR shrinks to 9, the upper fence drops to 40.25 and 41 becomes a second outlier.

Mistakes that catch people out

Comparing answers from different methods. A calculator that says Q1 = 17.5 and a spreadsheet that says 17.75 can both be right. Check the method before deciding one is wrong, and name it when you report quartiles.

Taking Q1 as a quarter of the range. Q1 is a quarter of the way through the sorted values, not from the minimum to the maximum. For the default data, min + range ÷ 4 = 22, against a true Q1 of 17.5.

Reading the whiskers as the minimum and maximum. With fences, the whiskers stop at the most extreme values inside them. The default data reach 52, but the upper whisker ends at 41.

Deleting every outlier. The rule flags values for a second look. Remove one only for a reason, such as a typing error, and if it stays, describe the data with the median and IQR.

Pasting thousands separators. 1,200 becomes 1 and 200, which adds a value and shifts every quartile. Paste plain numbers and check n.

Popular calculations

Each opens the calculator with those numbers filled in, and they can be changed once it is open. Quartiles are by the median of halves unless another method is named.

Small textbook data sets

One data set, several methods

Test scores and heights

Data with outliers

Salaries, wages and prices

How this was checked

The engine reproduces all 59 published values it was tested against: the NIST/SEMATECH Handbook’s 90th percentile of 12 resistivity readings by three rules, 95.1981, 95.1957 and 95.1972; the QUARTILE.INC, QUARTILE.EXC and PERCENTILE.INC examples in Microsoft’s Excel help, 3.5, 15, 43 and 1.9; all 32 quartiles in Table 2 of Langford (2006) for 1 to 4, 5, 6 and 7; the nine deciles in the Python statistics documentation; and the TI calculator exercise in the OpenIntro guide.

An independent implementation written from R’s definitions agreed in 252,000 comparisons across all nine Hyndman and Fan types, and NumPy 2.4 agreed in 70,200 to within 4 parts in 10 trillion. The halves methods were checked 15,000 times by two other routes, and fences in exact whole number arithmetic, so a value exactly on a fence counts as inside. Every address above was opened and checked for a distinct title and a clean result.

Common questions

How do you find Q1 and Q3?

Sort the numbers and find the median. By the method most textbooks and TI calculators use, Q1 is the median of the values below it and Q3 the median of those above. For 1, 3, 5, 7, 9 and 11, Q1 = 3 and Q3 = 9.

Do you include the median when finding quartiles?

It depends on the method. With an odd count, TI calculators and the US Common Core leave the median out of both halves, while Tukey’s hinges put it in both. For 1 to 7 that gives Q1 = 2 and Q3 = 6, or 2.5 and 5.5. With an even count the two agree.

What is the difference between QUARTILE.INC and QUARTILE.EXC?

Both interpolate between sorted values but at different positions: (n − 1)p + 1 for QUARTILE.INC and (n + 1)p for QUARTILE.EXC, which needs at least 3 values. For 1 to 8, QUARTILE.INC gives Q1 = 2.75 and QUARTILE.EXC gives 2.25.

How do you find outliers with the IQR?

Work out IQR = Q3 − Q1 and the fences Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. Values beyond them are outliers, and values beyond 3 × IQR are extreme outliers. With Q1 = 17.5 and Q3 = 27.5 the fences are 2.5 and 42.5, so 52 is an outlier.

What is the five number summary?

The minimum, Q1, the median, Q3 and the maximum, the numbers a box plot is drawn from. For the default data in this calculator it is 12, 17.5, 21.5, 27.5 and 52.

What does the IQR tell you that the standard deviation does not?

The IQR measures the spread of the middle half, so one wild value barely moves it, while a single outlier can inflate the standard deviation a great deal. For roughly normal data the IQR is about 1.35 standard deviations.

Related Calculators and Reference