Quick answer
The interquartile range (IQR) is the difference between the third quartile (75th percentile) and the first quartile (25th percentile) of a data set. It measures the spread of the middle 50% of values and is resistant to outliers.
Formula: IQR = Q3 − Q1
What is the interquartile range?
The interquartile range (IQR) is the spread of the middle half of your data: the distance between the first quartile (Q1, the 25th percentile) and the third quartile (Q3, the 75th percentile).
IQR = Q3 − Q1
Because it ignores the lowest 25% and the highest 25% of values, the IQR barely reacts to a handful of extreme values. That makes it the standard measure of spread for skewed data such as session duration, order value or page load time, where a few huge values would distort the range or the standard deviation.
How to find the interquartile range
- Sort the values from smallest to largest.
- Find the median (Q2). It splits the data into a lower half and an upper half.
- Find Q1, the middle of the lower half, and Q3, the middle of the upper half.
- Subtract: IQR = Q3 − Q1.
Worked example: session durations
Twelve sessions on a pricing page lasted (in seconds, sample data):
12, 18, 25, 31, 40, 44, 52, 61, 75, 90, 140, 610
The median is the average of the 6th and 7th values: (44 + 52) ÷ 2 = 48 seconds. With the method most spreadsheets and Python use by default (linear interpolation, Excel QUARTILE.INC):
- Q1 = 29.5 seconds
- Q3 = 78.75 seconds
- IQR = 78.75 − 29.5 = 49.25 seconds
Compare that with the mean and standard deviation of the same data: mean 99.8 seconds, standard deviation 164.5 seconds. One 610-second session (a tab left open) more than doubles the mean, while the median and IQR describe what a typical visit looked like.
Remove the 610-second session and recompute: the mean falls from 99.8 to 53.5 seconds (−46%), the median from 48 to 44, and the IQR from 49.25 to 40. The IQR moves, but far less than the mean.
Why different tools give different quartiles
There is more than one accepted way to compute quartiles, and they disagree on small samples. Hyndman and Fan (1996) list nine. On the twelve sessions above:
| Method | Where you see it | Q1 | Q3 | IQR |
|---|---|---|---|---|
| Linear interpolation (inclusive) | Excel QUARTILE.INC, Google Sheets QUARTILE, NumPy and R defaults | 29.5 | 78.75 | 49.25 |
| Median of halves (Tukey's hinges) | Many textbooks and calculators | 28 | 82.5 | 54.5 |
| Exclusive | Excel QUARTILE.EXC, some statistics packages | 26.5 | 86.25 | 59.75 |
None of these is wrong. With large data sets the differences shrink to almost nothing. With small samples, state which method you used, and use the same one when you compare periods.
Using the IQR to flag outliers
Tukey's rule marks a value as a potential outlier if it falls outside:
lower fence = Q1 − 1.5 × IQR
upper fence = Q3 + 1.5 × IQR
In the example, the upper fence is 78.75 + 1.5 × 49.25 = 152.6 seconds. The 610-second session is flagged; the 140-second session is not. The lower fence is negative, so nothing is flagged at the bottom.
A flagged value is a question, not an automatic deletion. A 610-second session might be an idle tab, or a real buyer comparing plans. Check the session before you drop it; see outliers in data and winsorization for ways to limit their influence without throwing them away.
IQR vs range vs standard deviation
| Measure | Uses | Sensitive to extremes? | Best for |
|---|---|---|---|
| Range (max − min) | Two most extreme values | Very | Quick sanity check |
| Standard deviation | Every value, squared distances | Yes | Roughly symmetric data |
| Interquartile range | Middle 50% | Little | Skewed data, outlier screening |
The IQR pairs naturally with the median, the same way the standard deviation pairs with the mean. A box plot draws exactly these numbers: the box runs from Q1 to Q3, the line in the middle is the median, and the whiskers reach to the fences.
Where it shows up in analytics
- Time on page and session duration, which always have long right tails.
- Page performance. Web performance teams report the 75th percentile (Q3) rather than the mean; Google's Core Web Vitals thresholds are assessed at P75. See percentile.
- Order values and revenue per user, to describe the typical customer without the few largest accounts.
In TapCub, the distribution report shows how a metric spreads across users or sessions in buckets, and performance cards switch between P75, P95, median and average, so you can read the middle of the distribution instead of an average pulled by a few slow pages. The descriptive statistics page lists the other summaries worth reporting alongside the IQR.
Sources
- Hyndman, R. J. and Fan, Y. (1996). Sample quantiles in statistical packages. The American Statistician, 50(4).
- NIST/SEMATECH. e-Handbook of Statistical Methods: percentiles.
- Microsoft. QUARTILE.INC function.
- Google. Web Vitals: thresholds are measured at the 75th percentile.
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.