How to Make and Read a Box Plot: Quartiles, Whiskers and Outliers

By Dr. Zubair Khalid, DVM, MS, PhD ·

How to Make and Read a Box Plot: Quartiles, Whiskers and Outliers

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.

What Is a Box Plot and How Do You Read One?

A box plot is a graph that summarizes a set of numbers using five values: the smallest whisker end, the first quartile (Q1), the median, the third quartile (Q3), and the largest whisker end. The box holds the middle half of the data, the line inside is the median, and any dots beyond the whiskers are outliers. To make one, sort your data, find the median and the two quartiles, compute the interquartile range (IQR = Q3 minus Q1), then draw whiskers out to the most extreme points that stay within 1.5 times the IQR of the box [1][7].

The box edges are the quartiles. Q1 is the value with about 25% of the data below it and Q3 has about 75% below it, so the box covers the middle 50%. The IQR is the width of that box and is your main measure of spread. The median line sits inside the box and marks the center. Whiskers reach toward the tails but stop at the last real data point inside the fences, so they are not always the minimum and maximum.

The fences are the cutoffs for outliers. The inner fences sit at Q1 minus 1.5 times the IQR and Q3 plus 1.5 times the IQR. Points past those are drawn as separate markers. Some fields also use outer fences at 3 times the IQR, which flag points that are far out; the 1.5 and 3 multipliers are conventions, not laws [7].

FeatureWhat it shows
Box bottom (Q1)25th percentile
Line in boxMedian (50th percentile)
Box top (Q3)75th percentile
Box heightIQR, the middle-half spread
Whisker endsMost extreme points inside the fences
Dots beyond whiskersOutliers

To read quartiles off the graph, drop a horizontal line from each box edge to the axis: the lower edge reads as Q1 and the upper edge as Q3. The gap between them is the IQR. If you are finding quartiles by hand, sort the values and take the median of the lower half for Q1 and the median of the upper half for Q3; software uses interpolation instead, so values can differ slightly [2]. A tall box means the middle half is spread out; a short box means it is tightly packed. Compare groups by whether the medians line up, whether the boxes overlap, and whether the whiskers and dots suggest different shapes.

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):

QuantityValue
Q114.05
Median15.0
Q316.15
IQR2.10
Lower fence10.90
Upper fence19.30
Lower whisker end12.1
Upper whisker end17.1
Outlier24.6
Mean15.7
SD3.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.

Finding Quartiles by Hand Versus by Software

The quartiles are the part most people get wrong, because there is more than one correct way to compute them. The method you choose changes the box edges, and on small samples the change can be large enough to move a point in or out of the outlier zone.

The median-of-halves method

This is the method taught in many introductory courses. Sort the data. Find the median, which splits the set into a lower half and an upper half. If n is odd, leave the median itself out of both halves. Q1 is the median of the lower half and Q3 is the median of the upper half. For the eleven values in the worked example (12.1 through 24.6), the median is 15.0, the lower half is the five values below it, and Q1 is their middle value, 13.9. The upper half gives Q3 = 16.4. Compare that with the interpolated values of 14.05 and 16.15 in the main example: same data, different box.

The interpolation method

Software usually interpolates between the two values that bracket the quartile position. R's default (type 7), numpy's default, and many spreadsheet functions do this. The position of Q1 is 1 + (n minus 1) times 0.25 and of Q3 is 1 + (n minus 1) times 0.75, counted along the sorted list, and you blend the neighboring values by the fractional part. This is why the same numbers can give a slightly different box in Excel, R, Python and GraphPad [2]. Neither method is wrong; they are different definitions of "the value below which 25% fall."

What to report

Name the method or the software in your figure legend. For large samples the two methods converge, so the choice matters mainly when n is small, which is exactly when readers are most likely to scrutinize the box.

Inner and Outer Fences, and What the Whiskers Really Mean

The fence rule decides which points get drawn individually. The inner fences are Q1 minus 1.5 times the IQR and Q3 plus 1.5 times the IQR. The outer fences, used in some conventions, sit at Q1 minus 3 times the IQR and Q3 plus 3 times the IQR. A point between the inner and outer fence is sometimes called a mild outlier and one beyond the outer fence an extreme outlier. These labels are descriptive; the multipliers are conventions chosen for convenience, not thresholds with biological or physical meaning [7].

A common misconception is that the whiskers run to the minimum and maximum. They do not, under the standard Tukey rule. The lower whisker ends at the smallest observation that is still at or above the lower fence, and the upper whisker ends at the largest observation at or below the upper fence. If your smallest value happens to sit inside the fence, the whisker reaches it; if it sits outside, the whisker stops at the next value in and the smallest point is drawn as a dot. Some tools default to min-max whiskers instead, which is why the legend must state the convention.

A second misconception is that the whisker is a confidence interval or a standard deviation. It is neither. It is a data range bounded by the fence rule, so it says nothing about how precisely the median is estimated. If you need that, use a notched box or report the standard error separately.

A described diagram

Picture a vertical box on an axis running from 10 to 26. The box bottom sits at 14.05 and the top at 16.15, with a line at 15.0. A whisker drops from the box bottom to 12.1 and another rises from the box top to 17.1. A single dot floats at 24.6, well above the top whisker. The lower fence at 10.90 and upper fence at 19.30 are invisible but explain why the whiskers stop where they do: 12.1 is the lowest real point above 10.90, and 17.1 is the highest real point below 19.30.

Reading Shape, Skew and Sample Size From the Box

A box plot encodes more than five numbers if you read the spacing. When the median line sits near the center of the box and the whiskers are roughly equal, the middle of the distribution is fairly symmetric. When the median sits close to Q1 and the upper whisker is long, the data are skewed to the right: the upper tail stretches out. The reverse pattern signals left skew. This is a rough read, because a single extreme point can stretch a whisker without the bulk of the data being skewed.

The box also hides things. A sample with two clusters, say a group of low responders and a group of high responders, can collapse into one ordinary-looking box with a median in the gap between clusters. The box cannot show you that gap. Overlaying the individual points, or adding a histogram or dot plot beside the box, restores the information the summary threw away. This is the same argument Weissgerber and colleagues made when they urged researchers to move beyond bar and line graphs, which hide distribution shape even more thoroughly [5].

Sample size changes how much you should trust the box. With a handful of points per group, Q1 and Q3 are unstable and the fence rule can flag an ordinary value as an outlier or miss a real one. As a rough guide, when groups have fewer than about ten points, show the points themselves alongside the box. A box drawn from six values and a box drawn from six hundred look identical, so always print n in the legend.

Comparing Groups and Avoiding the Usual Traps

When you place several boxes side by side, compare them in a fixed order. First check whether the medians sit at different heights. Then look at how much the boxes overlap: heavily overlapping boxes with similar medians suggest the groups are alike in their middle half. Then look at the whiskers and dots for differences in spread or in the tails. Two groups can share a mean and still have completely different boxes, which is the failure mode of the mean-plus-error-bar chart [5][6].

Notches add a visual cue about the median. The notch half-width is about 1.58 times the IQR divided by the square root of n, and if two notches do not overlap that is strong evidence the medians differ [3]. Treat it as a signal, not a test: the rule is approximate and behaves poorly at small n, so confirm any comparison that matters with a formal test.

Watch for these traps. Do not compare a box with min-max whiskers against one with 1.5-times-IQR whiskers and read a difference that is only a convention. Do not report quartiles without saying which quantile method produced them, since small samples can shift the box edges between packages [2]. Do not treat a flagged point as an error; it is a prompt to inspect the observation, and formal outlier tests are a separate step [7]. And do not read a box plot as a statement about significance: non-overlapping notches are evidence, not a p-value.

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

  1. NIST/SEMATECH e-Handbook of Statistical Methods: Box Plot
  2. Hyndman RJ, Fan Y. Sample quantiles in statistical packages. The American Statistician, 1996
  3. McGill R, Tukey JW, Larsen WA. Variations of box plots. The American Statistician, 1978
  4. Krzywinski M, Altman N. Visualizing samples with box plots. Nature Methods, 2014
  5. Weissgerber TL, Milic NM, Winham SJ, Garovic VD. Beyond bar and line graphs: time for a new data presentation paradigm. PLOS Biology, 2015
  6. Spitzer M, Wildenhain J, Rappsilber J, Tyers M. BoxPlotR: a web tool for generation of box plots. Nature Methods, 2014
  7. NIST/SEMATECH e-Handbook: What are outliers in the data?

Related Articles