What the interquartile range measures
The interquartile range is the width of the middle half of your data. Sort the observations, find the value a quarter of the way up (Q1) and the value three quarters of the way up (Q3), and subtract. Half of every data set lies between those two numbers, by construction.
That construction gives the IQR a property the standard deviation does not have: it is resistant. Move the largest observation from 41 to 41,000 and Q1, Q3 and the IQR do not change at all, because the quartiles depend only on where an observation sits in the order, not on how far away it is. The standard deviation, which squares distances, would change enormously. That is why the IQR is the spread measure that belongs with a median, and why box plots are built from quartiles rather than from means.
The IQR is also the engine of the most widely used outlier rule in statistics. John Tukey proposed marking any point more than 1.5 interquartile ranges beyond the nearer quartile, and that convention is now baked into the whiskers of almost every box plot you will see. The multiplier is a judgement call, not a derivation: it is calibrated so that on normally distributed data roughly 0.7% of observations get flagged.
Three conventions for the quartiles, and why they disagree
The median is unambiguous. The quartiles are not, and the disagreement is entirely about what to do with the median when the count is odd.
Tukey's hinges. Split the sorted data at the median. When n is odd, leave the median out of both halves. Q1 is the median of the lower half, Q3 the median of the upper half. For 1 to 9, the halves are 1,2,3,4 and 6,7,8,9, giving Q1 = 2.5 and Q3 = 7.5.
Moore and McCabe. Same procedure, except that when n is odd the median belongs to both halves. For 1 to 9 the halves are 1,2,3,4,5 and 5,6,7,8,9, giving Q1 = 3 and Q3 = 7. This is the convention in many introductory textbooks and in the TI graphing calculators.
Linear interpolation. Forget halves and treat the quartile as a percentile. The value at proportion p sits at position 1 + (n - 1)p in the sorted list, and if that position falls between two observations you interpolate. For 1 to 9, Q1 sits at position 1 + 8 x 0.25 = 3, which is the third value, 3. This is Excel's QUARTILE.INC, R's default type 7 and NumPy's default.
All three are defensible and all three are in daily use, which is why this calculator asks. On the same nine integers they give IQRs of 5, 4 and 4. Neither answer is wrong; they are answers to slightly different questions, and the only real error is comparing a quartile computed one way with a quartile computed another. The percentile calculator exposes the same choice for arbitrary percentiles.
Once you have Q1 and Q3, the rest is mechanical. IQR = Q3 - Q1. The lower fence is Q1 minus 1.5 IQR, the upper fence is Q3 plus 1.5 IQR, and anything beyond either is flagged.
Worked example: six values, by hand
Take 7, 15, 36, 39, 40, 41. They are already sorted, and n = 6 is even, so all three conventions treat the halves identically here.
- Find the median. With six values, average the 3rd and 4th: (36 + 39) / 2 = 37.5.
- Split at the median. Lower half: 7, 15, 36. Upper half: 39, 40, 41.
- Q1 is the median of the lower half. Three values, so take the middle one: Q1 = 15.
- Q3 is the median of the upper half. Again the middle of three: Q3 = 40.
- Subtract. IQR = 40 - 15 = 25.
- Build the fences. 1.5 x 25 = 37.5. Lower fence = 15 - 37.5 = -22.5. Upper fence = 40 + 37.5 = 77.5.
- Check the data against them. Every value lies between -22.5 and 77.5, so nothing is flagged.
The five-number summary is 7, 15, 37.5, 40, 41. Draw a box from 15 to 40 with a line at 37.5 and whiskers out to 7 and 41 and you have the box plot. Notice how asymmetric it is: the median sits close to Q3, so the lower quarter of the box is stretched. That is a left-skewed distribution, and the single value of 7 sitting eight units below Q1 is what causes it - even though it is nowhere near the fence.
Now add a seventh value, 200. Sorted: 7, 15, 36, 39, 40, 41, 200. The median is now 39. By Tukey's hinges the halves are 7,15,36 and 40,41,200, so Q1 = 15 and Q3 = 41. IQR = 26, and the upper fence is 41 + 39 = 80. The value 200 is flagged, and Q1 has not moved at all - the resistance in action.
How to read the IQR and the flagged points
The IQR is in the units of your data and describes the concentration of the bulk of it. An IQR of 25 on values running from 7 to 41 means the middle half spans most of the observed range, so the data are widely spread. An IQR of 2 on the same range would mean the data are tightly clustered with long thin tails.
Compare the median's position within the box to judge skew. If the median sits nearer Q1, the upper half of the middle is stretched and the distribution leans right; if it sits nearer Q3, it leans left. This reading is more reliable than comparing the mean with the median, because it is not affected by how extreme the extremes are.
Treat a flagged point as a question, not a verdict. The 1.5 x IQR rule identifies observations that are unusual relative to this data set's own middle half, which is a useful trigger for checking a transcription, a unit, or an instrument. It is not evidence that the value is wrong, and deleting flagged points because they were flagged is how genuine findings get thrown away. On a perfectly normal distribution the rule still flags about 7 observations in every 1,000, and on a heavy-tailed or skewed distribution such as incomes or waiting times it flags far more than that - which is a statement about the shape of the data, not about data quality.
For a stricter screen, raise the multiplier. Tukey's own terminology called points beyond 1.5 IQR outside and points beyond 3.0 IQR far out, and this calculator lets you set the multiplier directly. Raising it always flags the same points or fewer, never more, since the fences move outward on both sides.
The three quartile conventions on the same data
| Data | n | Method | Q1 | Median | Q3 | IQR |
|---|---|---|---|---|---|---|
| 1 to 9 | 9 | Tukey | 2.5 | 5 | 7.5 | 5 |
| 1 to 9 | 9 | Moore & McCabe | 3 | 5 | 7 | 4 |
| 1 to 9 | 9 | Excel QUARTILE.INC | 3 | 5 | 7 | 4 |
| 1 to 8 | 8 | Tukey | 2.5 | 4.5 | 6.5 | 4 |
| 1 to 8 | 8 | Excel QUARTILE.INC | 2.75 | 4.5 | 6.25 | 3.5 |
| 7, 15, 36, 39, 40, 41 | 6 | Tukey | 15 | 37.5 | 40 | 25 |
| 7, 15, 36, 39, 40, 41 | 6 | Excel QUARTILE.INC | 20.25 | 37.5 | 39.75 | 19.5 |
With an even n the two half-splitting methods always agree with each other, but the interpolating method can still differ from both, as the last two rows show.
Assumptions, limits and common errors
- Comparing quartiles computed by different conventions. If your homework uses Moore & McCabe and your spreadsheet uses QUARTILE.INC, the two will disagree on odd-sized data sets and neither is wrong. Fix the convention before you compare.
- Reading a flagged point as an error. The rule marks points for inspection. Removing them because the rule marked them biases every subsequent estimate and is not a defensible cleaning step on its own.
- Applying the 1.5 multiplier to skewed data without thinking. The multiplier is calibrated on a symmetric normal distribution. On right-skewed data such as incomes or durations it flags large values much more often than 0.7% and never flags small ones, which is a property of the rule rather than a finding.
- Using the IQR on very small samples. With fewer than about eight observations the quartiles are determined by one or two data points each and move dramatically when a single value changes. Report the range and the sorted data instead.
- Assuming IQR and standard deviation are interchangeable. For a normal distribution IQR is about 1.349 standard deviations, and dividing the IQR by 1.349 is a standard robust estimate of sigma. That relationship holds only for the normal distribution and fails badly on skewed data.
- Forgetting that the fences are not data values. Box plot whiskers are drawn to the most extreme observation inside each fence, not to the fence itself. The fence is a threshold; the whisker end is always an actual observation.
Where the IQR fits among measures of spread
Choose between the IQR and the standard deviation the same way you choose between the median and the mean. Skewed data, heavy tails, or values you do not fully trust point to the median and IQR; symmetric well-behaved measurements point to the mean and standard deviation. Quoting a median with a standard deviation, or a mean with an IQR, mixes the two schemes and confuses readers.
The quartiles are just three particular percentiles - the 25th, 50th and 75th - so the percentile calculator will reproduce them and will also give you the 90th or 99th when the tails are what matter, as in latency reporting. The median itself is available directly from the mean, median and mode calculator.
For a formal outlier test on data you believe to be normal, standardise the suspect observation with the z-score calculator and read the tail probability from the normal distribution calculator. That approach makes a distributional assumption the IQR rule does not, so it is more powerful when the assumption holds and misleading when it does not. The robust alternative to both is the median absolute deviation, which uses the median of the absolute distances from the median and is even less sensitive to extremes than the IQR.
Finally, the five-number summary on this page is a complete description of a box plot. If you are drawing one by hand, take the minimum, Q1, median, Q3 and maximum from the table, draw the box between the quartiles, mark the median inside it, and extend whiskers to the furthest observations still inside the fences, plotting anything beyond as an individual point.
