Quartiles, Box Plots & Outliers
Summarize any dataset with five numbers, picture it as a box, and spot the values that don't fit.
Five numbers that describe a whole dataset
Suppose you have the exam scores of 200 students, or the price of every house sold in a city last month. You cannot eyeball hundreds of numbers at once. Instead, statisticians boil a dataset down to just five numbers — and then draw a small picture, the box plot, that shows those five numbers at a glance.
To get there, we first cut the data into quarters.
Quartiles: cutting the data into four
Line all your values up from smallest to largest. The median is the middle value — it splits the data into a bottom half and a top half. The quartiles just repeat that same idea:
- Q1 (the first quartile) is the median of the bottom half — about a quarter of the data lies below it.
- Q2 is the overall median — half the data lies below it.
- Q3 (the third quartile) is the median of the top half — about three quarters of the data lie below it.
So Q1, Q2 and Q3 chop the sorted data into four groups, each holding roughly 25% of the values.
The IQR: spread of the middle half
The distance between Q1 and Q3 is the interquartile range, or IQR. It measures how spread out the middle half of the data is. Unlike the full range (maximum minus minimum), the IQR ignores the extreme tails, so a single wild value cannot inflate it. That makes the IQR a resistant measure of spread.
The box plot
A box-and-whisker plot draws the five-number summary as a picture. A box stretches from Q1 to Q3, so the length of the box is the IQR. A line inside the box marks the median. Then two whiskers reach out from the box toward the smallest and largest values that are not unusually extreme.
Try it below: feed the tool a dataset and watch it build the box, draw the median line and whiskers, and flag any outliers as separate points.
Flagging outliers: the 1.5×IQR rule
How far from the middle is 'too far'? The most common convention builds a fence on each side of the box, one and a half IQRs out from the quartiles:
- The data is already sorted. With n = 10 (even), the median is the average of the 5th and 6th values: (10 + 12) / 2 = 11.
- Bottom half (the first five values): 4, 7, 8, 9, 10. Its median is the middle value, so Q1 = 8.
- Top half (the last five values): 12, 14, 15, 18, 40. Its median is Q3 = 15.
- IQR = Q3 − Q1 = 15 − 8 = 7, so 1.5 × IQR = 10.5.
- Fences: lower = 8 − 10.5 = −2.5, upper = 15 + 10.5 = 25.5. The value 40 is above 25.5, so it is a high outlier; every other value falls inside the fences.
Check your understanding
- Quartiles Q1, Q2 (the median) and Q3 split sorted data into four groups of about 25% each.
- The five-number summary is the minimum, Q1, median, Q3, and maximum.
- The IQR = Q3 − Q1 is the spread of the middle 50% and resists extreme values.
- A box plot draws the box from Q1 to Q3 with the median inside, and whiskers out to the most extreme non-outlier values.
- A point is a potential outlier if it is below Q1 − 1.5×IQR or above Q3 + 1.5×IQR; the longer whisker shows the direction of skew.