How to Make and Read a Box Plot: Quartiles, Whiskers and Outliers
By Dr. Zubair Khalid, DVM, MS, PhD ·

A box plot (also called a box and whisker plot) summarizes a sample with its median and quartiles and shows how far the tails reach. The box spans the middle half of the data, a line inside marks the median, and whiskers extend toward the extremes. Points that fall too far from the box are drawn individually as outliers. The NIST/SEMATECH e-Handbook describes the box plot as a graphical summary of location, spread and outliers [1].
You need this plot because summary statistics alone can hide the shape of your data. Weissgerber and colleagues reviewed 703 articles in top physiology journals and found that continuous data were mostly shown as bar and line graphs, which can hide very different distributions; they recommend scatterplots, box plots and histograms, especially for small samples [5]. Spitzer and colleagues built BoxPlotR for the same reason: summary statistics in bar plots can hide differences in the structure of the data [6]. This article covers the arithmetic, the drawing rules and the reading rules, with a worked example you can reproduce in any package.
Quick Answer
- The box edges are the first quartile (Q1) and third quartile (Q3). The line inside is the median.
- The interquartile range is IQR = Q3 - Q1.
- Tukey's inner fences are Q1 - 1.5 x IQR and Q3 + 1.5 x IQR. Whiskers extend to the most extreme data points that lie inside the fences; points beyond are drawn individually as outliers.
- Quartiles are not uniquely defined. Hyndman and Fan described nine sample-quantile definitions used by statistical packages, so Q1 and Q3 can differ slightly between Excel, R, Python and GraphPad for the same small data set. State which method you used [2].
- For small samples (roughly n < 10 per group), overlay the individual points or use a dot plot. Five summary numbers from a handful of points can mislead.
How to Make a Box Plot
Step 1: Order the data and find the median
Sort the values from smallest to largest. The median is the middle value when n is odd, or the average of the two middle values when n is even. The median estimates the center of the distribution, but it is an estimate from your sample, not the population center.
Step 2: Find Q1 and Q3
Q1 is the value below which roughly 25% of the data fall; Q3 is the value below which roughly 75% fall. With software, these come from a quantile function. With linear interpolation (the R type 7 method, which is also the numpy default), you locate the position of the quartile in the sorted list and interpolate between neighboring values. Different packages use different definitions, so your Q1 and Q3 can shift by a small amount depending on the tool [2].
Step 3: Compute the IQR and the fences
$$IQR = Q3 - Q1$$
$$Lower\ fence = Q1 - 1.5 \times IQR$$
$$Upper\ fence = Q3 + 1.5 \times IQR$$
The factor 1.5 is a convention, not a law of nature. It defines which points get drawn individually. NIST documents this fence rule as part of standard outlier detection [7].
Step 4: Draw the whiskers and the outliers
The lower whisker ends at the smallest data point that is still at or above the lower fence. The upper whisker ends at the largest data point at or below the upper fence. Any point outside the fences is plotted as a separate marker. Whiskers therefore do not always reach the minimum and maximum, and they do not represent a confidence interval.
Step 5: Label everything
State in the legend what the box, the line, the whiskers and the points mean, and give n per group. Whisker conventions (1.5 x IQR versus min-max versus percentiles) vary between tools, so a reader cannot guess yours.
Worked Example
Take a hypothetical sample of n = 11 measurements:
12.1, 13.4, 13.9, 14.2, 14.8, 15.0, 15.3, 15.9, 16.4, 17.1, 24.6
Using linear interpolation (R type 7, numpy default):
| Quantity | Value |
|---|---|
| Q1 | 14.05 |
| Median | 15.0 |
| Q3 | 16.15 |
| IQR | 2.10 |
| Lower fence | 10.90 |
| Upper fence | 19.30 |
| Lower whisker end | 12.1 |
| Upper whisker end | 17.1 |
| Outlier | 24.6 |
| Mean | 15.7 |
| SD | 3.27 |
The fences are 14.05 - 1.5 x 2.10 = 10.90 and 16.15 + 1.5 x 2.10 = 19.30. The smallest value inside the fences is 12.1, so the lower whisker stops there. The largest value inside the fences is 17.1, so the upper whisker stops there. The value 24.6 sits above 19.30 and is plotted as an outlier.
Notice what the outlier does to the mean. The mean is 15.7 and the SD is 3.27, both pulled upward by the single value 24.6, while the median stays at 15.0. This is the practical reason to prefer a box plot over a bar graph of mean plus SD when a distribution is skewed or contains outliers. If you want to compute these numbers for your own data, the Box Plot Maker on this site will do the arithmetic and draw the plot.
How to Read a Box Plot
Read the plot in layers. The median line gives you location. The box height gives you spread: a tall box means the middle half of the data is widely dispersed. The whisker length tells you how far the tails reach before the fence rule cuts them off. Isolated points tell you that some observations sit far from the bulk of the sample.
Compare boxes across groups by looking at three things: whether the medians sit at different heights, whether the boxes overlap, and whether the whiskers and outliers suggest different shapes. Two groups can have identical means and very different boxes. That is the failure mode of the bar graph that Weissgerber and colleagues documented [5].
McGill, Tukey and Larsen introduced variations including variable-width and notched box plots [3]. Notches are roughly:
$$Notch\ half\text{-}width = 1.58 \times \frac{IQR}{\sqrt{n}}$$
The constant 1.58 is the value R uses. If the notches of two boxes do not overlap, that is strong evidence the medians differ. In the worked example the notch half-width is 1.58 x 2.10 / sqrt(11) = 1.00, so the notch spans 14.0 to 16.0. Notches are a visual guide, not a formal test, and they behave poorly at very small n.
Box Plot vs Bar Graph
A bar graph of mean plus error bars shows two numbers per group. A box plot shows five, plus every point that falls outside the fences. When distributions are symmetric and clean, the two look similar. When they are skewed, bimodal or contain outliers, the bar graph hides the structure and the box plot reveals it [5][6].
The trade-off is familiarity. Many readers outside statistics are trained on bar graphs, so a box plot needs a clear legend. Krzywinski and Altman's Points of Significance column explains how to read and draw box plots and why they are advantageous for showing samples [4]. If your audience is mixed, consider a box plot with the individual points overlaid, which gives both the summary and the raw data.
Common Mistakes
- Using min-max whiskers without saying so. The default in many tools is 1.5 x IQR, but some draw whiskers to the extremes. State your convention in the legend.
- Reporting Q1 and Q3 without naming the quantile method. Excel, R, Python and GraphPad can return slightly different values for the same small data set [2]. Name the method or the software.
- Treating the whisker as a confidence interval. It is not. It is the range of points inside the fences.
- Treating an outlier as an error. A point beyond the fence is a flag for inspection, not proof of a mistake. NIST covers formal outlier detection separately [7].
- Drawing a box plot for n = 4 per group. Five summary numbers from four points misrepresent the sample. Overlay the points or use a dot plot.
- Comparing notches as if they were a hypothesis test. Non-overlapping notches suggest different medians, but the notch rule is approximate [3].
- Forgetting n in the legend. A box from 200 points and a box from 6 points look identical without it.
Limitations
Quartiles are estimates from your sample. With small n, Q1 and Q3 are unstable, and the fence rule can flag a perfectly ordinary value as an outlier or miss a real one. The 1.5 x IQR multiplier is a convention; other multipliers change which points are drawn individually.
Box plots also hide multimodality. A sample with two distinct clusters can produce a single box that looks unremarkable. If you suspect bimodality, plot a histogram or overlay the points. For small samples (roughly n < 10 per group), the five-number summary is too coarse to trust on its own.
Finally, the plot says nothing about the underlying distribution or about statistical significance. Two boxes with non-overlapping notches are evidence of a difference in medians, not a p-value. If you need a test, run one.
Frequently Asked Questions
What is the difference between a box plot and a box and whisker plot?
They are the same plot. "Box and whisker plot" is the older, more descriptive name; "box plot" is the common short form. Both refer to the Tukey-style display of median, quartiles, whiskers and outliers [1].
How do I decide whether a point is an outlier?
Compute the IQR, then the fences at Q1 - 1.5 x IQR and Q3 + 1.5 x IQR. Any point outside the fences is drawn individually as an outlier [7]. This is a screening rule, not a verdict. Inspect flagged points before removing them.
Why do different software packages give me different quartiles?
Hyndman and Fan documented nine sample-quantile definitions in use across statistical packages [2]. For large samples the differences are negligible; for small samples they can shift Q1 or Q3 enough to change the box edges. Report the software and method.
Can I use a box plot for a sample of five?
You can draw one, but it will not tell you much. Five summary numbers from five points can hide the shape entirely. Overlay the individual points or use a dot plot instead.
What does a non-overlapping notch mean?
It is strong evidence that the two medians differ [3]. The notch is roughly median +/- 1.58 x IQR / sqrt(n). Treat it as a visual signal, not a formal test, and confirm with an appropriate statistical test if the comparison matters.
References
- NIST/SEMATECH e-Handbook of Statistical Methods: Box Plot
- Hyndman RJ, Fan Y. Sample quantiles in statistical packages. The American Statistician, 1996
- McGill R, Tukey JW, Larsen WA. Variations of box plots. The American Statistician, 1978
- Krzywinski M, Altman N. Visualizing samples with box plots. Nature Methods, 2014
- Weissgerber TL, Milic NM, Winham SJ, Garovic VD. Beyond bar and line graphs: time for a new data presentation paradigm. PLOS Biology, 2015
- Spitzer M, Wildenhain J, Rappsilber J, Tyers M. BoxPlotR: a web tool for generation of box plots. Nature Methods, 2014
- NIST/SEMATECH e-Handbook: What are outliers in the data?