Written and maintained by CASRAI Editorial Board
Last updated
The IQR of a box plot is the length of the box: the upper end of the box (Q3, the 75th percentile) minus the lower end (Q1, the 25th percentile). Read those two edges off the scale, subtract, and you have it. The whiskers, the median line and any dots beyond the whiskers play no part in the subtraction, although in the fence version of the plot the IQR is what decides where the whiskers and dots fall.
What is the IQR on a box plot? (definition)
The interquartile range (IQR, also written IQ in the NIST handbook) is the spread of the middle half of a data set. The NIST/SEMATECH e-Handbook defines it as the difference between the upper and lower quartiles, and describes the box plot as drawn with the lower quartile as the 25th percentile and the upper quartile as the 75th percentile. On the picture, that means the box edges are Q1 and Q3, so the box length is the IQR. For the calculation without a plot, see the five-number summary and IQR guide; this page is about reading the value from a drawn box plot.
IQR formula for a box plot
IQR = Q3 − Q1
- Q1 (lower quartile): the value at the lower edge of the box, the 25th percentile.
- Q3 (upper quartile): the value at the upper edge of the box, the 75th percentile.
- IQR: the distance between the two, in the same units as the axis.
NIST computes the quartiles from the ordered data as the 0.25(N+1)th and 0.75(N+1)th points, interpolating when the position is not a whole number. Other software uses other quartile rules (see the table below), which is why a box plot from one program can show a slightly different IQR from the same data in another.
How to find the IQR of a box plot: worked example
Take 11 test scores, already sorted: 12, 14, 15, 17, 18, 20, 22, 23, 25, 27, 52.
- Locate Q1. Position 0.25 × (11 + 1) = 3, so Q1 is the 3rd value: 15. This is the bottom edge of the box.
- Locate the median. Position 0.5 × 12 = 6, so the median is the 6th value: 20. This is the line inside the box.
- Locate Q3. Position 0.75 × 12 = 9, so Q3 is the 9th value: 25. This is the top edge of the box.
- Subtract. IQR = 25 − 15 = 10.
If you are given only the picture, do steps 1 and 3 by eye instead: find where the bottom and top edges of the box meet the axis, and subtract. A read-off from an image is only as exact as its gridlines, so quote it as approximate unless the figure labels the quartiles.
IQR formula boxplot: checking the fences
NIST’s fence version of the box plot draws a whisker only as far as the most extreme point inside the fences, and marks points outside them separately. Using the IQR of 10:
- Lower inner fence L1 = Q1 − 1.5 × IQR = 15 − 15 = 0
- Upper inner fence U1 = Q3 + 1.5 × IQR = 25 + 15 = 40
- Lower outer fence L2 = Q1 − 3.0 × IQR = 15 − 30 = −15
- Upper outer fence U2 = Q3 + 3.0 × IQR = 25 + 30 = 55
The upper whisker stops at 27, the largest point below U1. The value 52 lies between U1 (40) and U2 (55), so NIST draws it as a small circle (a mild outlier). The lower whisker reaches 12, the minimum, because nothing falls below L1. The same arithmetic is used in finding an outlier in statistics.
Does the IQR change with outliers or whisker length?
No, not by changing the extreme values. Only the box edges enter the subtraction. Replace 52 with 90 in the data above: the sorted positions of Q1 (3rd) and Q3 (9th) hold the same values, so the IQR is still 25 − 15 = 10. The range, by contrast, goes from 52 − 12 = 40 to 90 − 12 = 78. Now 90 exceeds U2 (55), so NIST draws it as a large circle (an extreme outlier), yet the box has not moved.
| Data set | Q1 | Q3 | IQR | Range |
|---|---|---|---|---|
| Max value 52 | 15 | 25 | 10 | 40 |
| Max value 90 | 15 | 25 | 10 | 78 |
This is the practical reason to use the IQR for spread when a few values are extreme. For the range read from the same kind of plot, see how to find the range in a box-and-whisker plot. Note the caveat: removing or adding a data point in the middle of the ordering does shift the quartile positions, so the IQR is unaffected by how extreme the end values are, not by whether they are present.
How to read an IQR boxplot: interpretation
| Feature on the plot | What it shows |
|---|---|
| Bottom and top edges of the box | Q1 and Q3 (25th and 75th percentiles) |
| Box length | The IQR, the spread of the middle half of the data |
| Line or symbol inside the box | The median |
| Whisker, basic plot | Extends from each quartile to the minimum or maximum point |
| Whisker, fence version | Extends to the smallest point above L1 and the largest point below U1 |
| Small circle | A point between an inner and an outer fence (L1–L2 or U1–U2) |
| Large circle | A point beyond an outer fence (below L2 or above U2) |
To compare two groups on one scale, compare box lengths: the group with the longer box has the larger IQR, meaning its middle half is more spread out. The IQR is in the data’s own units, so compare it only between plots with the same units, and read both off the same axis.
Assumptions and common mistakes
- Measuring whisker to whisker. That distance is not the IQR. In the fence version it is not even the range, because outlier dots lie beyond the whisker.
- Counting the median line as a box edge. Q1 and Q3 are the outer edges of the box.
- Mixing quartile methods. Q1 and Q3 depend on the rule used. The same 11 scores give an IQR of 10 with NIST’s 0.25(N+1) rule and 8 with the linear-interpolation default in NumPy, Excel’s QUARTILE.INC and R’s default (16 and 24). Say which rule you used.
- Reading too much from a picture. A plot shows what the software computed; a read-off from a small image is only as exact as the gridlines allow.
- Comparing unlike scales. Box lengths on plots with different axes are not comparable by eye.
How to report the IQR (APA-style example)
Report the median with the IQR, ideally with Q1 and Q3 so a reader can reproduce the box. Example for the data above: The median score was 20 (IQR = 10; Q1 = 15, Q3 = 25). If your software uses a different quartile rule from NIST’s, name it, for example: Quartiles were computed with linear interpolation (Excel QUARTILE.INC).
How to calculate the IQR in Excel, R or Python
Excel (scores in A1:A11). QUARTILE.INC uses linear interpolation; QUARTILE.EXC uses the 0.25(N+1) rule that matches NIST:
=QUARTILE.EXC(A1:A11,3)-QUARTILE.EXC(A1:A11,1) (returns 10)
=QUARTILE.INC(A1:A11,3)-QUARTILE.INC(A1:A11,1) (returns 8)
R (type 7 is the default; type 6 is the 0.25(N+1) rule):
x = c(12,14,15,17,18,20,22,23,25,27,52)
IQR(x) # 8, type 7
IQR(x, type = 6) # 10
boxplot(x)
Python (NumPy 1.22 or later; checked on these data):
import numpy as np
x = [12,14,15,17,18,20,22,23,25,27,52]
q1, q3 = np.percentile(x, [25, 75]) # 16.0, 24.0 -> IQR 8
q1, q3 = np.percentile(x, [25, 75], method='weibull') # 15.0, 25.0 -> IQR 10
For a fuller R workflow, see box plots in R and the IQR in R.
FAQ
How do I find the IQR of a box plot?
Read Q1 at the bottom edge of the box and Q3 at the top edge, then subtract: IQR = Q3 − Q1. Ignore the whiskers and any dots.
What does the IQR boxplot tell you?
The length of the box is the spread of the middle half of the data. A longer box means more spread; the median line shows the centre of the data.
What is the IQR formula for a boxplot?
IQR = Q3 − Q1, where Q1 is the 25th percentile and Q3 the 75th percentile. The fences used to flag outliers are Q1 − 1.5 × IQR and Q3 + 1.5 × IQR.
Do outliers affect the IQR?
Making an extreme value more extreme does not change the IQR, as the 52-versus-90 example shows. Adding or removing values can still shift the quartiles. See also the median and interquartile range.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, Box Plot (checked 2026-10-29).
- NIST/SEMATECH e-Handbook of Statistical Methods, Measures of Scale (checked 2026-10-29).








