Quick answer
A box plot is a chart that summarizes numeric data with a box from the first to the third quartile, a line at the median, whiskers reaching toward the extremes and separate dots for values beyond the outlier fences. It makes center, spread and skew comparable across groups.
Formula: IQR = Q3 − Q1; fences = Q1 − 1.5 × IQR and Q3 + 1.5 × IQR; whiskers end at the furthest data inside the fences
What is a box plot?
A box plot, also called a box-and-whisker plot, is a chart that summarizes a set of numbers with a box running from the first quartile to the third quartile, a line at the median, and two whiskers that reach toward the smallest and largest values. Points that fall far outside the box are usually drawn one by one, so unusual values stay visible instead of disappearing into an average.
The chart is associated with the statistician John Tukey and his work on exploratory data analysis. Its strength is compactness. One box takes a narrow strip of space, so you can line up ten pages, countries or weeks next to each other and see at a glance which group sits higher, which is more spread out and which has a long tail. A table of averages cannot do that, because an average says nothing about spread.
The price of that compactness is detail. A box plot is drawn from a handful of summary numbers, so it cannot tell you whether the values inside the box are spread evenly or bunched into two clusters. The later sections show both sides: how to read and build the chart, and when a histogram says more.
How to read a box plot: the five-number summary
Most box plots are built on the five-number summary: minimum, first quartile, median, third quartile and maximum. Each one maps to a part of the drawing.
| Part of the chart | Number it shows | How to read it |
|---|---|---|
| Lower end of the box | Q1, the 25th percentile | A quarter of the values are at or below it |
| Line inside the box | Median, the 50th percentile | Half the values are below, half above |
| Upper end of the box | Q3, the 75th percentile | Three quarters of the values are at or below it |
| Length of the box | Interquartile range, Q3 − Q1 | Spread of the middle half |
| Whiskers | Smallest and largest values inside the fences | Reach of the ordinary data |
| Separate points | Values beyond the fences | Candidates for a closer look |
Three reading habits cover most cases. First, compare the median lines to see which group is typically higher. Second, compare the box lengths to see which group is more consistent. Third, look at the position of the median inside the box and the relative length of the whiskers: a median near the bottom of the box with a long upper whisker points to a right skew, which is normal for durations, order values and load times.
Not every tool draws whiskers the same way. The NIST handbook describes a basic version whose lines run to the minimum and maximum, and a version with fences in which extreme points are plotted separately. Some software lets you set whiskers at chosen percentiles instead. Before you compare two charts from two tools, check the whisker rule printed in the legend or the documentation.
Worked example: quartiles and fences on session duration
Fifteen sessions on a documentation page lasted, in seconds and already sorted (sample data):
8, 14, 21, 27, 33, 38, 42, 47, 55, 63, 72, 88, 104, 150, 420
Step 1: quartiles. This example uses linear interpolation, the default of NumPy's percentile function. With 15 values, the position of a quantile p is 1 + 14 × p.
- Q1: position 1 + 14 × 0.25 = 4.5, halfway between the 4th value (27) and the 5th (33), so Q1 = 30.
- Median: position 8, so median = 47.
- Q3: position 11.5, halfway between the 11th value (72) and the 12th (88), so Q3 = 80.
Step 2: interquartile range. IQR = 80 − 30 = 50 seconds.
Step 3: fences. The usual rule places fences 1.5 box lengths beyond the box:
- Lower fence = 30 − 1.5 × 50 = −45
- Upper fence = 80 + 1.5 × 50 = 155
Step 4: whiskers and flagged points. Whiskers stop at the most extreme observed values that are still inside the fences. The lower whisker ends at 8 and the upper whisker at 150, not at 155, because 155 is only a boundary and no session lasted that long. The 420-second session is beyond the upper fence and is drawn as a separate point.
The mean of the fifteen sessions is 1,182 ÷ 15 = 78.8 seconds, almost as high as Q3. About three out of four sessions were shorter than the "average" session. The box plot makes this obvious, while a single average hides it.
Outlier fences: 1.5 × IQR and 3 × IQR
NIST names two levels of fences. The inner fences sit at Q1 − 1.5 × IQR and Q3 + 1.5 × IQR; a point beyond one of them is called a mild outlier. The outer fences sit at Q1 − 3 × IQR and Q3 + 3 × IQR; a point beyond those is an extreme outlier. In the example, the upper outer fence is 80 + 3 × 50 = 230, so the 420-second session counts as extreme.
"Flagged" does not mean "wrong". It means the value is far from the middle half relative to how wide that half is. A 420-second session might be a tab left open, or it might be the one reader who worked through the whole page. Check the raw record before deleting anything. The options after that (keep, fix, cap or exclude with a note) are covered in outliers in data.
The fences also depend on the data you give them. Drop the 420-second session and recompute: Q1 = 28.5, median = 44.5, Q3 = 69.75, IQR = 41.25, and the upper fence falls to about 131.6. Now the 150-second session is flagged, although it was an ordinary whisker end a moment ago. Removing outliers and redrawing can produce new ones, so do not repeat the cut until the chart looks tidy.
Quartile definitions differ between tools. Hyndman and Fan compared the sample quantile definitions used by statistical packages. If you take Q1 and Q3 at positions 16 × 0.25 and 16 × 0.75 instead (the exclusive method), this data gives Q1 = 27, Q3 = 88, IQR = 61 and an upper fence of 179.5. The 420-second session is still flagged here, but with a value around 170 the two methods would disagree. State the method when you publish fences.
Comparing two groups side by side
Box plots earn their place when there is more than one group. Suppose a new page layout, B, collects fifteen sessions (sample data): 25, 31, 36, 40, 44, 49, 53, 58, 62, 66, 71, 77, 84, 93, 112.
| Statistic (seconds) | Page A | Page B |
|---|---|---|
| Minimum | 8 | 25 |
| Q1 | 30 | 42 |
| Median | 47 | 58 |
| Q3 | 80 | 74 |
| Maximum | 420 | 112 |
| IQR | 50 | 32 |
| Upper fence | 155 | 122 |
| Points beyond the fences | 420 | none |
| Mean | 78.8 | 60.1 |
The two boxes tell a clear story: B has a higher median (58 against 47), a higher Q1 (42 against 30) and a narrower box. Short visits became less short and sessions became more alike. The mean says the opposite, 60.1 against 78.8, and the whole reversal comes from one 420-second session in A.
That does not prove B is better. Fifteen sessions per page is a very small sample, the boxes overlap heavily, and a box plot is a description, not a significance test. Use it to decide what to examine, then collect enough data and choose a test that fits the metric. For why the two averages disagree, see mean vs median.
Box plot vs histogram vs interquartile range
The interquartile range is one number, the length of the box. A percentile is one position in the sorted list. A box plot draws several of these together. A histogram does something different: it cuts the value range into bins and shows how many observations fall into each.
| Question | Box plot | Histogram |
|---|---|---|
| Compare many groups at once | Strong: one narrow box per group | Weak beyond two or three groups |
| See clusters or two peaks | Not visible | Visible with sensible bins |
| Read median and quartiles | Direct | Has to be estimated |
| Spot single extreme values | Drawn as points | May sit in a barely visible bar |
| Depends on a bin choice | No | Yes |
Here is a case where the box plot is blind. Two sets of 13 load durations in seconds (sample data):
- Set E: 10, 17, 23, 30, 37, 43, 50, 57, 63, 70, 77, 83, 90
- Set C: 10, 29, 29, 30, 31, 31, 50, 69, 69, 70, 71, 71, 90
Both have minimum 10, Q1 30, median 50, Q3 70 and maximum 90, so their box plots are identical. Counting them into bins separates them at once:
| Bin (seconds) | Set E | Set C |
|---|---|---|
| 0 to under 20 | 2 | 1 |
| 20 to under 40 | 3 | 5 |
| 40 to under 60 | 3 | 1 |
| 60 to under 80 | 3 | 5 |
| 80 to 100 | 2 | 1 |
Set E is spread evenly. Set C has two groups, around 30 and around 70 seconds, with almost nothing in between, which often means two different kinds of visitor or two different code paths. Rule of thumb: use box plots to compare groups, and open a histogram for any group whose behavior you are about to explain.
Common mistakes when reading box plots
- Treating box length as sample size. A long box means wide spread, not more data. Print n under each box.
- Reading the line as the mean. The line is the median. If a tool also marks the mean, it uses a separate symbol.
- Drawing boxes for tiny groups. With five values, the chart pretends to a precision the data cannot support. Plot the individual points instead.
- Calling every dot an error. In skewed data, a number of points beyond the upper fence is expected.
- Comparing charts with different whisker rules. Min-to-max whiskers and 1.5 × IQR whiskers look similar and mean different things.
- Using a box plot for yes/no data. Converted or not has only two values; report the rate and its uncertainty.
Box plots and TapCub
TapCub does not draw box plots. What it can give you for the example above are the distribution view, a quartile summary for time gaps and the raw rows.
- Look at the shape. In All-platform analytics › Behavior › Distribution, choose session duration as the subject. You get total, mean and median cards, a histogram on fixed duration buckets, and the count and share in each bucket. A mean far above the median is the same signal as Page A.
- Get quartiles for a time gap. In All-platform analytics › Behavior › Interval, pick a start and an end event. The summary lists sample size, minimum, 25th, median, 75th, 90th, maximum and average, which is enough to sketch a box for "time from sign-up to first purchase" and compute the fences by hand. Pairs longer than the maximum gap are left out, so the maximum is bounded by your setting.
- Take the rows out when you need a real chart. List session durations in All-platform analytics › Behavior › SQL query (the
v_sessionsview) and download the result as CSV, or create a sessions job in All-platform analytics › Data › Data export on a plan that includes export. Draw the boxes in a spreadsheet or notebook. - Check the zeros first. A session with no signal after its first event counts as 0 seconds. If more than a quarter of sessions are like that, Q1 is 0 and the box starts at the axis, so show the zero share next to the chart.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.3.7 Box Plot.
- NIST/SEMATECH e-Handbook of Statistical Methods, 7.1.6 What are outliers in the data? (inner and outer fences, mild and extreme outliers).
- Matplotlib documentation, matplotlib.pyplot.boxplot (box, median line and whisker options).
- NumPy documentation, numpy.percentile (default linear method; cites Hyndman and Fan, 1996).
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Analyst
Explores traffic sources, conversion funnels, and retention, using clear metric definitions and concrete examples to explain what the numbers mean.