The guide
A box plot is five numbers and a rule, and the rule decides more than most charts admit
The same ten values can give different quartiles, fences and outliers depending on which of nine quantile definitions a program uses, so a box plot should say how it was drawn.
- nine definitions sample quantile rules catalogued by Hyndman and Fan in 1996
- 1.5 IQR Tukey's fence beyond each quartile; 3 IQR marks far out
- 2 of 9 methods flag 30 as an outlier in the worked example below
- 28.375 upper fence of the worked example under type 7
- 1.58 IQR / sqrt(n) half-width of a median notch
Read the full guide Fold the guide
A box plot looks like the most settled picture in statistics. A box spans the middle half of the data, a line marks the median, and whiskers reach out toward the extremes. It fits in a thumbnail and it compares a dozen groups at a glance. That economy is real, and it is also why the chart deserves more suspicion than it usually gets.
The picture rests on two choices that most charts never state. One is how to compute a quartile from a finite sample. The other is where the whiskers stop and which points are drawn on their own. Change either and the same data gives a different box.
What the box summarises
The box plot grew out of the five-number summary: the smallest value, the lower quartile, the median, the upper quartile and the largest value. Wikipedia’s article on the summary makes the case for it plainly. Five order statistics give location, spread and range without assuming any particular shape of distribution, and because they use ranks rather than the mean they suit ordinal measurements too.
The NIST/SEMATECH e-Handbook describes the drawing in the same spirit. Compute the median and the quartiles, draw a box from the lower quartile to the upper one, mark the median, and run a line from each end of the box to the extreme points. The box is the body of the data, the middle 50 percent. The handbook adds that when several groups are compared the box width can be set in proportion to the number of points, although many programs simply make every box the same width.
History gives the chart two parents. Wikipedia credits Mary Eleanor Spear with the range bar in her 1952 book on charting statistics, and John Tukey with the box-and-whisker form in 1970, later published in his Exploratory Data Analysis of 1977. Tukey’s version is the one with fences and separately plotted outliers.
What the box hides is just as important. Two groups with the same five numbers can have completely different shapes inside them. A sample with two clusters, one low and one high, can produce a tidy box whose median sits in a gap where no observation lives at all. Wikipedia notes that violin and bean plots exist precisely because the classical box plot cannot show whether a distribution has one peak or several. The box also says nothing about sample size unless someone writes n beside it, and a box drawn from six points looks exactly as confident as one drawn from six thousand.
Why programs disagree about quartiles
For a continuous distribution the quartiles are exact: the points below which a quarter and three quarters of the probability lie. A sample of ten numbers has no such points. Something has to sit between the third and fourth values, and there are many reasonable ways to decide what.
Rob Hyndman and Yanan Fan counted them in The American Statistician in 1996. They wrote the sample quantiles in common use as one formula, a weighted step between two neighbouring order statistics, and found nine definitions that differ only in how the position and the weight are chosen. Three are step functions that jump from one data value to the next. Six interpolate linearly, and differ in where along the sorted data each value is assumed to sit.
The NIST handbook calls them R1 to R9 and states its own default, the sixth, which places the k-th of n sorted values at the fraction k/(n+1). The R documentation lists the same nine as types 1 to 9 and makes type 7, which places the values at (k-1)/(n-1), its default. Python’s statistics module offers two methods, called exclusive and inclusive, which Wikipedia’s quantile article matches to the sixth and seventh definitions. NumPy names all nine and also defaults to the linear seventh.
Hyndman and Fan recommended the eighth, which is approximately median-unbiased whatever the distribution. Twenty years later Hyndman wrote on his blog that the paper had failed in its main aim. No major package had adopted type 8 as its default, and the variety of definitions continued. Wikipedia’s article on percentiles says it in one line: there is no standard definition.
Here is the worked example, and you can type it into the tool beside this essay. Take ten values: 5, 8, 10, 11, 13, 14, 16, 18, 20 and 30. Under type 7 the quartiles are 10.25 and 17.5, the interquartile range is 7.25, and the upper fence sits at 17.5 plus 1.5 times 7.25, which is 28.375. The value 30 lies beyond it and is drawn as an outlier, and the upper whisker stops at 20.
Now switch to type 6, the NIST default. The quartiles become 9.5 and 18.5, the interquartile range widens to 9, and the upper fence moves out to 32. The same 30 is now inside the fence and the whisker runs all the way to it. Step through all nine definitions and only 2 of 9 methods, types 4 and 7, call 30 an outlier. Nothing about the data changed. Only the definition did.
That is the whole case for printing the method on the chart. A reader who cannot see the definition has no way to know which of the two pictures they are looking at.
For large samples the differences shrink, because neighbouring order statistics sit close together. NIST’s own example of twelve resistivity measurements shows how small the gap can be. The handbook reports the 90th percentile as 95.1981 by its default, 95.1957 by type 7 and 95.1972 by type 8. In a small sample, or one with a gap near a quartile, the choice can move a fence by a visible amount and turn points into outliers or back.
The 1.5 IQR rule, and what an outlier is not
Tukey’s fences come from the interquartile range, the distance between the quartiles. The NIST handbook gives the construction step by step. The inner fences sit 1.5 IQR below the lower quartile and 1.5 IQR above the upper one, and the outer fences sit at 3 IQR. A whisker is drawn to the most extreme observation still inside the inner fences, so it always ends on a real data value. Points between the inner and outer fences are mild outliers. Points beyond an outer fence are extreme, what Tukey called far out.
The whisker ending on data is easy to get wrong. A program that draws the whisker to the fence itself shows a value that does not exist in the sample. Wikipedia’s box plot article is firm on this point and adds that because whiskers can be defined in several ways, the convention in use should be stated in the caption. Other conventions run the whiskers to the minimum and maximum, or to fixed percentiles such as the 2nd and 98th or the 9th and 91st.
An outlier by this rule is a point that sits unusually far from the middle of this particular sample. It is not a mistake, and the rule does not say it should be removed. NIST’s page on outliers says they should be investigated carefully because they often carry valuable information about the process. Wikipedia’s article on outliers warns that removing a point only because a rule flagged it is a controversial practice that can invalidate results.
The rule also flags points in perfectly healthy data. In a large sample from a normal distribution a small share of points always lands beyond the inner fences, simply by chance, and the more data you have the more such points you will see. In a skewed or heavy-tailed distribution the long tail produces many flagged points that are an honest part of the shape, as Wikipedia’s article on outliers notes. A box plot of such data with a cloud of circles on one side is describing skew, not reporting faults.
Notches, and when to show every point
Notches answer a narrower question than they seem to. They compare medians, and only medians, and they lean on assumptions that small samples rarely meet.
A notch narrows the box around the median to suggest how precisely that median is known. The R documentation for its box plot statistics sets the notch at the median plus or minus 1.58 IQR / sqrt(n), following McGill, Tukey and Larsen, and explains the intent: if the notches of two boxes do not overlap, that is rough evidence that the medians differ, at about a 95 percent level. The documentation also says the formula assumes roughly normal medians and similar sample sizes.
In small samples the notch often reaches past the quartiles, which gives the box a folded look. That is a warning, not a drawing error. For Set A in the tool’s opening example, eleven values from 2 to 25, the notch runs from about 5.71 to 14.29 while the lower quartile is 7.5, so the notch passes the hinge and the tool says so. With that few points the median is simply not known well enough for the notch to mean much.
Sometimes the right move is to show the raw points instead of, or on top of, the box. With a small group, the points themselves are often easier to read than a summary built from them. Jittering them slightly across the width of the box stops tied values from hiding behind each other. Showing the points also exposes the clusters and gaps that the box cannot.
None of this makes the box plot a weak chart. It is a fast, honest summary when it says what it is summarising. A useful habit is to put three facts in the caption: the quantile definition, the whisker rule and the number of observations in each group. The tool here prints the first two on the chart itself and writes n under every box, so a reader can check the numbers against the statistics table, or reproduce them in any package that names its method.
The method has limits worth stating. A box plot cannot show how many peaks a distribution has, it cannot tell a data error from a genuine extreme, and its notches are only a rough guide when samples are small or skewed. For those questions the raw points, a histogram, or a proper test of the medians will tell you more.
Sources
Every source consulted for this guide. Links checked October 24, 2026.
- Box plot Wikipedia
- Quartile Wikipedia
- Interquartile range Wikipedia
- Percentile Wikipedia
- Five-number summary Wikipedia
- Outlier Wikipedia
- Quantile Wikipedia
- 1.3.3.7. Box Plot NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology
- 7.1.6. What are outliers in the data? NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology
- 7.2.6.2. Percentiles NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology
- Sample quantiles in statistical packages Rob J Hyndman and Yanan Fan, The American Statistician 50(4), 1996
- Sample quantiles 20 years later Rob J Hyndman, Hyndsight blog
- Sample Quantiles (quantile.Rd) R Core Team, The R Project for Statistical Computing
- Box Plot Statistics (boxplot.stats.Rd) R Core Team, The R Project for Statistical Computing
- statistics - Mathematical statistics functions Python Software Foundation
- numpy.quantile NumPy Developers
- RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files RFC Editor, Internet Engineering Task Force
- CSV Injection OWASP Foundation