How to Calculate Interquartile Range- Step-by-Step Guide
What Is the Interquartile Range?
The interquartile range (IQR) measures the spread of the middle half of your data. It tells you where most of your values actually sit, without getting skewed by outliers or extreme scores.
You get it by subtracting the 25th percentile (Q1) from the 75th percentile (Q3). That's it. Simple in concept, annoying in practice if you don't know the steps.
Why Bother With IQR?
Range (max minus min) lies. One crazy outlier makes it useless. Standard deviation gets wrecked by extreme values too.
IQR ignores the top 25% and bottom 25% of your data. It shows you the core spread — where the real action happens.
You see IQR used in:
- Box plots and visual data summaries
- Outlier detection (anything below Q1 - 1.5×IQR or above Q3 + 1.5×IQR is suspicious)
- Salary data, real estate prices, test scores — anywhere outliers distort the picture
The Step-by-Step Calculation
Step 1: Sort Your Data
Arrange all values from smallest to largest. This is not optional. Mess this up and everything else fails.
Step 2: Find the Median (Q2)
The median splits your data in half — 50% below, 50% above.
- Odd count: The middle value is your median
- Even count: Average the two middle values
Step 3: Find Q1 (25th Percentile)
Q1 is the median of the lower half — the data below your overall median.
Step 4: Find Q3 (75th Percentile)
Q3 is the median of the upper half — the data above your overall median.
Step 5: Subtract
IQR = Q3 - Q1
Real Example With Numbers
Dataset: 3, 7, 8, 12, 14, 18, 22, 25, 30
Step 1: Already sorted. Nine values.
Step 2: Median = 14 (the 5th value)
Step 3: Lower half = 3, 7, 8, 12. Q1 = median of these = (7 + 8) / 2 = 7.5
Step 4: Upper half = 18, 22, 25, 30. Q3 = median of these = (22 + 25) / 2 = 23.5
Step 5: IQR = 23.5 - 7.5 = 16
The middle 50% of your data spans 16 units.
Even Number of Values? Here's the Catch
With an even dataset, you split exactly in half for Q1 and Q3. No special averaging needed — you just take the two halves and find their medians separately.
Dataset: 2, 4, 6, 8, 10, 12
- Median = (6 + 8) / 2 = 7
- Lower half: 2, 4, 6 → Q1 = 4
- Upper half: 8, 10, 12 → Q3 = 10
- IQR = 10 - 4 = 6
IQR vs Other Spread Measures
| Measure | What It Does | Outlier Sensitive? |
|---|---|---|
| Range | Max minus min | Yes — wrecked by one outlier |
| Variance/Std Dev | Average squared deviation from mean | Yes — pulled by extremes |
| IQR | Spread of middle 50% | No — ignores extremes |
| Interquartile Range | Q3 minus Q1 | No — the point |
How to Detect Outliers With IQR
This is where IQR earns its keep.
- Lower bound: Q1 - (1.5 × IQR)
- Upper bound: Q3 + (1.5 × IQR)
Anything outside these bounds gets flagged as a potential outlier.
Using our earlier example (Q1=7.5, Q3=23.5, IQR=16):
- Lower bound: 7.5 - (1.5 × 16) = 7.5 - 24 = -16.5
- Upper bound: 23.5 + (1.5 × 16) = 23.5 + 24 = 47.5
So values below -16.5 or above 47.5 would be outliers. In our dataset of 3-30, nothing qualifies.
Getting Started: Quick Checklist
- ☐ Write down all values and sort them smallest to largest
- ☐ Find the overall median — this is Q2
- ☐ Split data at the median into lower and upper halves
- ☐ Find median of lower half = Q1
- ☐ Find median of upper half = Q3
- ☐ Subtract: Q3 - Q1 = IQR
- ☐ Optional: Check for outliers using the 1.5×IQR rule
Common Mistakes That Wreck Your Calculation
- Including the median in both halves — when you split odd-numbered data, exclude the median value from both halves
- Forgetting to sort first — unsorted data gives you wrong percentiles every time
- Confusing Q1 with the 25th value — Q1 is the median of the lower half, not necessarily the first quarter position
- Using mean instead of median — Q1 and Q3 are medians of halves, not means
When IQR Doesn't Help
IQR shows spread, not typical values. A dataset of 1, 2, 100, 101 has the same IQR as 1, 50, 51, 101 — but the second one is way more "normal."
For small datasets, IQR can be unstable. With 5 values, you're basing everything on two medians of two-value halves. Not reliable.
For skewed distributions, IQR is your friend. For symmetric, roughly normal data, standard deviation often tells a clearer story.