Written and maintained by CASRAI Editorial Board
Published
On this page
Use a box plot when you want to compare the location and spread of several groups at once, or to see where the middle half of one data set sits and which values lie far from it. It summarises a batch with five numbers (minimum, lower quartile, median, upper quartile, maximum) rather than showing every observation, so it is the right choice for group comparison and outlier flagging and the wrong choice for very small samples or for questions about the shape of a distribution. The same advice applies to a box and whisker plot: the two names describe one chart.
Definition: what a box plot shows
A box plot draws the lower quartile (Q1) to the upper quartile (Q3) as a box that holds the middle 50% of the data, marks the median inside it, and extends whiskers outward. In its simplest form the whiskers run to the minimum and maximum. In the variant most software draws, whiskers stop at the most extreme points inside a fence, and points beyond the fence are plotted individually as outliers. OpenStax describes box plots, also called box-and-whisker plots, as giving a good graphical image of the concentration of the data and of how far extreme values are from most of it. For the arithmetic behind the quartiles see interquartile range and the five-number summary.
When to use a box plot
The NIST/SEMATECH e-Handbook of Statistical Methods gives the purpose of a box plot as checking location and variation shifts, and calls it an excellent tool for conveying location and variation information in data sets, particularly for detecting and illustrating location and variation changes between different groups of data (it credits Chambers, 1983). From that and from OpenStax, four situations favour a box plot.
Comparing groups on location and spread
Put one box per group on a shared axis. NIST lists the questions this answers: whether a factor is significant, whether location differs between subgroups, whether variation differs between subgroups, and whether there are outliers. NIST’s own example compares four machines on energy output: machine 3 has the highest typical output, near 72.5, and machine 4 is the least variable, with about half its readings within one unit. Side-by-side reading is covered in more depth in box and whisker plot comparison.
Flagging possible outliers
With the fence rule, points beyond the whiskers are drawn individually, so unusual values are visible without a separate test. The rule is set out below. A flagged point is a prompt to check the record, not a licence to delete it.
Summarising large amounts of information compactly
NIST describes the box plot as an effective tool for summarising large quantities of information. Many groups fit in one panel because each group costs only a box, two whiskers and a few dots.
Describing a skewed batch with quartiles
Krzywinski and Altman (Nature Methods, 2014) note in their figure captions that quartiles are more intuitive than the mean and standard deviation for skewed distributions, and that box plots are a more communicative way to show sample data. How to read asymmetry from the box is in box plot skewness.
When to use box and whisker plots instead of other charts
The table below compares the box plot with the histogram on the purposes each source gives. It uses only what NIST, OpenStax and Krzywinski and Altman state.
| Question you are asking | Box plot? | Basis |
|---|---|---|
| Do groups differ in location or variation? | Yes, one box per group | NIST e-Handbook 1.3.3.7: purpose is to check location and variation shifts |
| Are there unusually distant values? | Yes, with the fence variant | NIST 1.3.3.7: points beyond the fences are plotted as circles |
| How is the middle half of one batch spread? | Yes | OpenStax 2.4: box holds about the middle 50% of the data |
| Does the data have more than one mode, or what is its overall shape? | No, use a histogram | NIST 1.3.3.14: a histogram shows center, spread, skewness, outliers and the presence of multiple modes |
| Is the sample very small (fewer than 5 observations)? | Avoid | Krzywinski and Altman 2014: box plots reflect sample variability and should be avoided for very small samples (fewer than 5 observations) |
For a wider view of which graph answers which question, see types of graphs in statistics.
When not to use a box plot
Do not rely on a box plot for the shape of a distribution. Because it reports quartiles, two batches with different shapes can produce similar boxes; NIST names the presence of multiple modes as something a histogram shows, so check a histogram or an overlaid point display when modality matters. Do not use it for fewer than five observations, where Krzywinski and Altman recommend avoiding it; show the raw points instead. And do not use it when your reader needs the exact count in each category, which is a bar chart question.
Formula: the 1.5 × IQR fence rule
NIST defines the fence variant with these quantities.
- Q1 and Q3: the lower and upper quartiles; IQ = Q3 − Q1 is the interquartile range.
- L1 = Q1 − 1.5 × IQ and U1 = Q3 + 1.5 × IQ are the inner fences. Whiskers extend to the most extreme data points that lie inside them.
- L2 = Q1 − 3.0 × IQ and U2 = Q3 + 3.0 × IQ are the outer fences. Points between an inner and outer fence are drawn as small circles, and points beyond an outer fence as large circles.
Worked example with the arithmetic
OpenStax section 2.4 uses this ordered data set of n = 14 values: 1, 1, 2, 2, 4, 6, 6.8, 7.2, 8, 8.3, 9, 10, 10, 11.5.
- Median: the average of the 7th and 8th values, (6.8 + 7.2) ÷ 2 = 7.
- Q1: the median of the lower seven values (1, 1, 2, 2, 4, 6, 6.8) is the 4th value, 2.
- Q3: the median of the upper seven values (7.2, 8, 8.3, 9, 10, 10, 11.5) is the 4th value, 9.
- IQ = 9 − 2 = 7. Inner fences: 2 − 1.5 × 7 = −8.5 and 9 + 1.5 × 7 = 19.5. Every value lies between them, so the whiskers run to the minimum (1) and maximum (11.5) and no point is flagged.
Now add one constructed value, 25, to make n = 15 (this data point is an illustration, not a measurement). The median becomes the 8th value, 7.2. The lower half stays 1, 1, 2, 2, 4, 6, 6.8 so Q1 = 2; the upper half is 8, 8.3, 9, 10, 10, 11.5, 25 so Q3 = 10. IQ = 8, the upper inner fence is 10 + 1.5 × 8 = 22 and the upper outer fence is 10 + 3 × 8 = 34. The value 25 exceeds 22 but not 34, so it is drawn as a small circle, and the upper whisker stops at 11.5. The data table below sets the two cases side by side.
Quartile definitions differ between programs. The hand method above takes the median of each half. A program that interpolates between ranks gives Q1 = 2.5 and Q3 = 8.825 for the 14-value set, so state which rule your software uses when you compare numbers.
Interpretation: reading guidance
| What you see | What it indicates |
|---|---|
| Box much taller for one group | Larger spread in the middle 50% of that group (NIST: variation differences between groups) |
| One box sits higher on the axis | A location shift between groups (NIST: machine 3 in the energy example) |
| Median line off-centre in the box, or one whisker longer | Asymmetry in the batch; see the skewness guide |
| Isolated circles beyond a whisker | Candidate outliers by the fence rule; investigate before acting |
| Box width varies by group | In NIST’s description, width may be proportional to group size n |
Assumptions and common mistakes
- Assuming whisker ends are always the minimum and maximum. In the fence variant they are not; the extremes are the plotted circles.
- Comparing quartile numbers across programs without checking the quartile rule (shown above: 2 and 9 by hand, 2.5 and 8.825 by interpolation for the same data).
- Using a box plot on fewer than five observations (Krzywinski and Altman).
- Reading the box plot as showing modes or shape; use a histogram for that (NIST).
- Treating a flagged point as an error. The fence is a screening rule; see outliers in R for handling.
How to report a box plot (APA-style example)
Report the sample size, the median and the interquartile range as numbers in the text, and state the whisker rule in the figure note. For the 14-value set: The median was 7.0 (Q1 = 2.0, Q3 = 9.0, IQR = 7.0, n = 14); no values fell outside 1.5 × IQR of the quartiles. A figure note might read: Boxes show the interquartile range with the median marked; whiskers extend to the most extreme values within 1.5 × IQR of the quartiles; circles are values beyond. Naming the whisker rule and n is an editorial recommendation so that readers can interpret the figure.
How to calculate a box plot in Excel, R or Python
Excel. Select the data, then Insert, then Insert Statistics Chart, then Box and Whisker (available in recent Excel versions). R. boxplot(value ~ group, data = df, horizontal = TRUE) draws one box per group; see box plots in R. Python. import matplotlib.pyplot as plt; plt.boxplot([a, b], vert=False, whis=1.5, labels=['A','B']); plt.show() where a and b are lists of values and whis=1.5 sets the fence multiplier. Because defaults differ, check each program’s quartile rule against a hand calculation on a small set such as the one above.
Frequently asked questions
When should I use a box plot instead of a histogram?
Use a box plot to compare several groups or to see quartiles and outliers compactly; use a histogram when you need the shape of one distribution, including whether it has more than one mode (NIST e-Handbook 1.3.3.14).
When to use box and whisker plots: is there a minimum sample size?
Krzywinski and Altman advise avoiding box plots for very small samples (fewer than 5 observations). With so few points, plot the observations themselves.
Does a box plot show the mean?
The standard box plot marks the median, not the mean. OpenStax describes the middle 50% of the data lying inside the box with the median marked.
Is a point beyond the whisker always an outlier to remove?
No. It is flagged by the fence rule as unusual. Check the record and the measurement before deciding anything.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.3.7 Box Plot. https://www.itl.nist.gov/div898/handbook/eda/section3/boxplot.htm (checked 2026-11-14)
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.3.14 Histogram. https://www.itl.nist.gov/div898/handbook/eda/section3/histogra.htm (checked 2026-11-14)
- OpenStax, Introductory Statistics 2e, 2.4 Box Plots. https://openstax.org/books/introductory-statistics-2e/pages/2-4-box-plots (checked 2026-11-14)
- Krzywinski, M. and Altman, N. (2014). Visualizing samples with box plots. Nature Methods 11, 119-120. https://www.nature.com/articles/nmeth.2813 (figure captions checked 2026-11-14)
Data: Box plot summary and fence arithmetic for a 14-value and a 15-value data set
Five-number summary, interquartile range, 1.5 x IQR inner fences and flagged points for the OpenStax 2.4 box plot data set (n=14) and the same set with one constructed value, 25, added (n=15). Quartiles use the median-of-each-half method; fences follow NIST e-Handbook 1.3.3.7.
| Statistic | 14-value set (n=14) | With 25 added (n=15) |
|---|---|---|
| Minimum | 1 | 1 |
| Q1 | 2 | 2 |
| Median | 7 | 7.2 |
| Q3 | 9 | 10 |
| Maximum | 11.5 | 25 |
| IQR (Q3 - Q1) | 7 | 8 |
| Lower inner fence (Q1 - 1.5 x IQR) | -8.5 | -10 |
| Upper inner fence (Q3 + 1.5 x IQR) | 19.5 | 22 |
| Upper outer fence (Q3 + 3 x IQR) | 28.5 | 34 |
| Values flagged beyond inner fence | none | 25 (small circle) |
| Upper whisker end | 11.5 | 11.5 |
Sources
- OpenStax Introductory Statistics 2e, 2.4 Box Plots (accessed 2026-11-14)
- NIST/SEMATECH e-Handbook 1.3.3.7 Box Plot (accessed 2026-11-14)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







