Box Plots & Quartiles

Build a box plot from quartiles, flag outliers with the 1.5 × IQR rule and compare it with a histogram

Beginner
Groups
Below each box

Box plot on a shared axis(drag any dot to change that value)

Commute times (min)UF51015202530354045505560

Step 6 of 6: Outliers & whiskers

  1. 18
  2. 210
  3. 312
  4. 412
  5. 514
  6. 615
  7. 717
  8. 818
  9. 920
  10. 1024
  11. 1128
  12. 1255

Outliers (below −3 or above 37): 55

Whiskers reach the most extreme values inside the fences: 8 and 28

SummaryCommute times (min)
n12
Minimum8
Q112
Median (Q2)16
Q322
Maximum55
IQR10
Fences−3 to 37
Outliers55

From five numbers to a picture

A box plot (box-and-whisker plot) draws the five-number summary: minimum, first quartile Q1, median, third quartile Q3 and maximum. The box spans Q1 to Q3 with a line at the median, and the whiskers reach out to the most extreme values that are not outliers.

Method used here (median of halves): sort the data and find the median. Split the data into a lower half and an upper half. When n is odd, the median itself belongs to neither half. Q1 is the median of the lower half and Q3 is the median of the upper half. This is the method taught in most introductory courses and used by TI graphing calculators. Other methods exist: Tukey's hinges include the median in both halves when n is odd, and spreadsheet functions such as QUARTILE.INC interpolate between values, so software can give slightly different quartiles for the same small dataset.

Because quartiles only depend on the order of the values, the box is resistant to outliers in the same way the median is. That makes the IQR a better measure of spread than the range when the data contain a few extreme values.

The 1.5 × IQR rule is a convention, not a law. For data that really are normal, the fences sit about 2.7 standard deviations from the mean and flag only about 0.7% of values, so a flagged point is worth checking, not automatically deleting.

Quartiles split the data in four

Q1, the median (Q2) and Q3 cut the sorted data into four groups with about a quarter of the values in each.

The box is the middle half

The box runs from Q1 to Q3, so its width is the interquartile range (IQR): the spread of the middle 50% of the data.

Fences catch outliers

Values more than 1.5 × IQR below Q1 or above Q3 are flagged as outliers and drawn as separate points.

Built for comparison

Stack box plots on one axis to compare the centers, spreads and skew of several groups at a glance.

Key formulas

Interquartile range

IQR = Q3 − Q1

Outlier fences (Tukey's rule)

LF = Q1 − 1.5 × IQR,   UF = Q3 + 1.5 × IQR

LF, UF
lower and upper fence
outlier
any value with x < LF or x > UF

Whiskers

lower whisker = smallest value ≥ LF,   upper whisker = largest value ≤ UF

Datasets in the visualizer

DatasetnMinQ1MedianQ3MaxIQROutliers
Exam scores15526472819517none
Commute times (min)128121622551055
Outliers on both sides1122326294962, 49
Plant heights: fertilizer1118212426295none
Plant heights: control111215172131631

Reading a box plot

  • Center: compare the median lines. In the plant data the fertilizer median (24 cm) is above the whole control box (Q3 = 21 cm), which is a large difference.
  • Spread: a wider box means a larger IQR. Long whiskers mean the outer quarters are spread out, not that they contain more values.
  • Skew: if the median sits near the left of the box and the right whisker is long, the data are right-skewed, like the commute times.
  • What it hides: a box plot cannot show gaps or two separate clusters. That is why the visualizer draws a dot plot or histogram of the same data underneath.

How to use this visualizer

  1. 1
    Pick a dataset, or type your own numbers into the data box and press Apply.
  2. 2
    Use Back and Next (or the numbered step chips) to build the box plot one stage at a time. The sorted list shows the halves and the values each quartile comes from.
  3. 3
    Drag any dot sideways to change that value. The quartiles, fences and outlier flags update as you drag.
  4. 4
    Drag a value just past a fence and watch it turn red and leave the whisker.
  5. 5
    Switch Below each box to Histogram to see the same data as bars.
  6. 6
    Choose Compare two to stack a second group on the same axis, then compare the medians, boxes and whiskers.

Common mix-up

Each of the four sections of a box plot (lower whisker, left part of the box, right part of the box, upper whisker) holds about a quarter of the data. A longer section does not contain more values; it means those values are more spread out.

Practice problems

Problem 1: Odd number of values

Find the five-number summary, IQR, fences and any outliers for: 3, 5, 7, 8, 9, 11, 13, 15, 40.
Show solution

n = 9 (odd), already sorted. Median = 5th value = 9

Lower half (median left out): 3, 5, 7, 8 → Q1 = (5 + 7) / 2 = 6

Upper half: 11, 13, 15, 40 → Q3 = (13 + 15) / 2 = 14

IQR = 14 − 6 = 8; 1.5 × IQR = 12

LF = 6 − 12 = −6; UF = 14 + 12 = 26

40 > 26, so 40 is an outlier. Whiskers run from 3 to 15.

Min 3, Q1 6, median 9, Q3 14, max 40; IQR 8; outlier: 40

Problem 2: Even number of values

Daily deliveries over 10 days were 12, 15, 18, 20, 21, 23, 25, 26, 30, 45. Find Q1, the median, Q3, the fences and the whisker ends. Is 12 an outlier?
Show solution

n = 10 (even). Median = (5th + 6th) / 2 = (21 + 23) / 2 = 22

Lower half: 12, 15, 18, 20, 21 → Q1 = 18

Upper half: 23, 25, 26, 30, 45 → Q3 = 26

IQR = 26 − 18 = 8; 1.5 × IQR = 12

LF = 18 − 12 = 6; UF = 26 + 12 = 38

45 > 38 is an outlier; 12 ≥ 6 is not

Q1 18, median 22, Q3 26; fences 6 and 38; whiskers 12 to 30; only 45 is an outlier

Related visualizations

Discussion

Questions, ideas or a different approach? Join the conversation.