What quartiles are
Quartiles split a sorted dataset into four equal parts. Three cut points do the splitting: the first quartile Q1 (the 25th percentile), the second quartile Q2 (the 50th percentile, which is just the median), and the third quartile Q3 (the 75th percentile). Roughly 25% of the values lie below Q1, 50% below Q2, and 75% below Q3. Quartiles are the backbone of the five-number summary (minimum, Q1, median, Q3, maximum) and of the box-and-whisker plot.
How the quartiles are calculated
The core recipe is simple:
- Sort the values from smallest to largest.
- Q2 (median): the middle value. If there is an even number of values, average the two middle ones.
- Q1: the median of the lower half of the data.
- Q3: the median of the upper half of the data.
The only ambiguity is what to do with the median when the count is odd, and this is what the two methods on this calculator control:
- Exclusive (Tukey / Excel
QUARTILE.EXC): when the count is odd, the median value is excluded from both halves before taking their medians. This is the "median of halves" method taught in most introductory statistics courses. - Inclusive (Excel
QUARTILE.INC, NumPy's default "linear" method): the p-th quartile is found by linear interpolation at rankp×(n−1)in the zero-indexed sorted list, with p = 0.25, 0.5, 0.75. On odd-length data the median value is effectively shared between the halves.
The two methods agree on the median and often agree on Q1/Q3, but they can differ on small or odd-sized samples, which is why statistical software lets you pick.
Worked example
Take the dataset 7, 15, 36, 39, 40, 41 (already sorted, n = 6, even). The median is the average of the two middle values, 36 and 39, so Q2 = 37.5. The lower half is {7, 15, 36} with median Q1 = 15; the upper half is {39, 40, 41} with median Q3 = 40, giving IQR = Q3 − Q1 = 40 − 15 = 25. These are the exclusive-method quartiles. The inclusive (interpolation) method places the quartiles between values instead, returning Q1 = 20.25 and Q3 = 39.75 for the same data — both share the median 37.5. That gap is normal and is exactly why the method dropdown exists.
The interquartile range and outliers
The IQR = Q3 − Q1 is the width of the middle 50% of the data. Because it ignores the top and bottom quarters, it is resistant to outliers, unlike the full range (max − min) or the standard deviation. Tukey's fence rule flags a value as a suspected outlier when it falls below the lower fence Q1 − 1.5×IQR or above the upper fence Q3 + 1.5×IQR. Points beyond 3×IQR are sometimes called "far out." These fences are exactly what draws the whiskers on a box plot.
Frequently Asked Questions
Why do my quartiles differ from another tool?
.quantile() default to the inclusive method; many textbooks and Minitab use the exclusive method. Switch the method dropdown to match your source. On even-sized data the two usually coincide.