Five-Number Summary and Boxplots
What You’ll Learn
Section titled “What You’ll Learn”In this lesson you’ll learn to find quartiles and the five-number summary, compute the interquartile range, build a boxplot, and use the 1.5 × IQR rule to flag outliers.
The Concept
Section titled “The Concept”Percentiles and quartiles
Section titled “Percentiles and quartiles”The -th percentile is the value below which % of the data falls. If your score is at the 90th percentile, 90% of scores are below yours.
Quartiles are the percentiles that cut the data into four equal parts:
- Q1 (first quartile) = 25th percentile. Median of the lower half.
- Q2 (second quartile) = 50th percentile = the median.
- Q3 (third quartile) = 75th percentile. Median of the upper half.
To find them:
- Sort the data.
- Find the median. That’s Q2.
- Q1 is the median of the values below Q2.
- Q3 is the median of the values above Q2.
When is odd, exclude the median itself from both halves. (Different textbooks and software handle this slightly differently, so you’ll occasionally see small discrepancies in Q1 and Q3. The method here is the common one taught in intro courses.)
The five-number summary
Section titled “The five-number summary”Five values that describe a distribution compactly:
Together they tell you the center, the spread, and roughly the shape, using only positions. Because they’re all positional, the whole summary is resistant to outliers except for the min and max themselves.
Interquartile range
Section titled “Interquartile range”The IQR is the spread of the middle half of the data:
This is the resistant alternative to the standard deviation. It deliberately ignores the top 25% and bottom 25%, so extreme values can’t inflate it.
Compare the two spread measures:
| Standard deviation | IQR | |
|---|---|---|
| Uses | every value | middle 50% |
| Outliers | sensitive | resistant |
| Pairs with | mean | median |
| Best for | symmetric data | skewed data |
Notice the pairing. Report mean with standard deviation, or median with IQR. Mixing them (median with standard deviation) is unusual and usually a mistake.
Boxplots
Section titled “Boxplots”A boxplot (or box-and-whisker plot) draws the five-number summary.
- The box spans Q1 to Q3, so its width is the IQR.
- The line inside the box is the median. Not the mean.
- The whiskers extend to the most extreme values that are not outliers.
- Points beyond the whiskers are plotted individually as outliers.
Reading shape from a boxplot:
- Median centered in the box, equal whiskers - roughly symmetric.
- Median near the left of the box, longer right whisker - right-skewed.
- Median near the right of the box, longer left whisker - left-skewed.
Boxplots are at their best comparing groups. Four boxplots side by side let you compare centers and spreads at a glance in a way four histograms can’t match.
What a boxplot hides: it cannot show bimodality. Two very different distributions can produce identical boxplots, so for a single dataset a histogram tells you more. Use boxplots for comparison, histograms for shape.
The 1.5 × IQR rule for outliers
Section titled “The 1.5 × IQR rule for outliers”The standard rule defines fences:
Any value outside the fences is flagged as an outlier.
The 1.5 is a convention, chosen by John Tukey (who invented the boxplot) as a useful compromise. For normally distributed data it flags roughly 0.7% of values, which is a reasonable “worth a look” rate. Sometimes 3 × IQR is used to mark extreme outliers.
An important point about what to do next: a flagged outlier is not automatically an error, and you don’t automatically delete it. Investigate first. It might be a typo (a height of 1,700 cm), or it might be the most interesting data point you have (the one customer spending 50× the average). Deleting inconvenient data is how analyses go wrong.
Worked Examples
Section titled “Worked Examples”Example 1: Five-number summary, odd count.
Data: 12, 7, 3, 15, 9, 21, 18, 5, 11
Solution.
Sort: 3, 5, 7, 9, 11, 12, 15, 18, 21
, so the median is position 5: median = 11.
Lower half (excluding the median): 3, 5, 7, 9. Median of these is . So Q1 = 6.
Upper half: 12, 15, 18, 21. Median is . So Q3 = 16.5.
Five-number summary: 3, 6, 11, 16.5, 21
Example 2: Five-number summary, even count.
Data: 4, 8, 11, 14, 16, 20, 25, 30
Solution.
Already sorted. , so the median averages positions 4 and 5:
Lower half: 4, 8, 11, 14 →
Upper half: 16, 20, 25, 30 →
Summary: 4, 9.5, 15, 22.5, 30, and .
Example 3: Find the outliers.
Data: 18, 22, 25, 27, 28, 30, 31, 33, 35, 68
Solution.
, so median .
Lower half: 18, 22, 25, 27, 28 → (middle of five)
Upper half: 30, 31, 33, 35, 68 →
Checking every value: all fall between 13 and 45 except 68, which exceeds the upper fence.
68 is an outlier. The whisker on the right would stop at 35, the largest non-outlier, and 68 would be plotted as a separate point.
Notice the IQR of 8 was unaffected by the 68, which is exactly the resistance we wanted.
Example 4: Read a boxplot.
A boxplot has minimum 20, Q1 = 45, median 50, Q3 = 55, maximum 90. Describe the distribution.
Solution.
The box (45 to 55) is narrow, so the middle half is tightly packed around 50.
Distance from median to Q1 is 5; median to Q3 is also 5. The box is symmetric.
But the whiskers are wildly unequal: the left reaches down 25 units to 20, the right reaches up 35 units to 90.
So the middle is symmetric while both tails are long, with the right slightly longer. The distribution has a compact core and extreme values on both sides. Worth checking the fences: , so fences sit at 30 and 70, meaning both the minimum of 20 and the maximum of 90 would actually be flagged as outliers.
Example 5: Compare two groups.
Two branches’ customer wait times (minutes):
Branch A summary: 2, 5, 7, 9, 14 Branch B summary: 1, 4, 7, 15, 32
Solution.
Both have a median of 7, so “typical” wait is the same.
Branch B is far less consistent. Its upper quartile is 15, meaning a quarter of B’s customers wait over 15 minutes, versus over 9 at A. And B’s maximum of 32 is more than double A’s worst case.
Identical medians, very different customer experience. A manager looking only at median wait time would conclude the branches perform the same.
Real-World Applications
Section titled “Real-World Applications”Boxplots are the standard tool for comparing groups in scientific papers, precisely because a row of them compresses many distributions into one readable figure. When a paper compares treatment arms or experimental conditions, it’s usually boxplots.
Growth charts in pediatrics are percentile charts. A child “at the 40th percentile for height” is being compared to a reference distribution, and the doctor watches whether the child’s percentile stays stable over time rather than the raw number.
Standardized test reporting is percentile-based for the same reason: the raw score means nothing without knowing the distribution, and percentile position is directly interpretable.
Salary bands in HR are typically defined by quartiles. “This role pays in the second quartile for the market” is a statement about position in a distribution.
Fraud and anomaly detection often starts with IQR-based outlier flagging, because it’s simple, resistant, and needs no assumption that the data is normal. Transactions outside the fences get a second look rather than an automatic rejection, which mirrors the “investigate, don’t delete” principle.
In performance monitoring, the same percentile thinking from the previous lesson applies: p95 and p99 latency are percentiles, and engineers watch them instead of the mean because the tail is where user pain lives.
Retrying will remove your ✅ checkmark until you pass again.