What Is the Interquartile Range? (The "Middle 50% Rule")
Picture a classroom of 30 students whose exam scores range from 12 to 98. Two students bombed the test; one student scored nearly perfect. Those three scores pull the range (max − min = 86 points) up dramatically, making the spread look much wider than the experience of the other 27 students. The IQR captures only those 27 middle scores — the central bulk of the class — and gives you a truer picture of how spread out typical performance actually is.
The IQR is a core concept in descriptive statistics. According to the NIST/SEMATECH e-Handbook of Statistical Methods, the IQR is one of the primary robust measures of scale used alongside the median to describe data that is skewed or contains extreme values. The team at Statistics Fundamentals has built this guide to make every step of working with IQR clear.
- Formula: IQR = Q3 − Q1
- What it measures: The spread of the middle 50% of any sorted dataset
- Outlier rule: Any value below Q1 − 1.5×IQR or above Q3 + 1.5×IQR (Tukey's fence rule, 1977)
- Box plot connection: The IQR is the length of the box in a box-and-whisker plot
- Robust? Yes — unlike the range and standard deviation, IQR is not inflated by a single extreme value
- Best used when: Data is skewed, contains outliers, or you are summarizing with the median rather than the mean
Understanding Quartiles First (You Need This Before IQR)
The IQR formula requires Q1 and Q3. Before jumping to the calculation, it helps to understand what quartiles are and why they exist.
What Are Quartiles?
Quartiles are three boundary values — Q1, Q2, and Q3 — that divide a sorted dataset into four equal groups of 25% each. The word comes from "quarter," but it is worth noting that quartiles are boundary points, not groups. Each quartile marks where one-quarter of the data ends and the next begins.
First Quartile
Median
Third Quartile
Middle 50%
How Q1, Q2, and Q3 Divide a Dataset
Sort the dataset first. Then think of it as split into four segments of equal size:
| Boundary Point | What It Marks | Percentile Position |
|---|---|---|
| Q1 (First Quartile) | 25% of values fall below Q1; 75% fall above | 25th percentile |
| Q2 (Second Quartile / Median) | 50% of values fall below Q2; 50% fall above | 50th percentile |
| Q3 (Third Quartile) | 75% of values fall below Q3; 25% fall above | 75th percentile |
The Relationship Between Quartiles and Percentiles
Percentiles rank any data point relative to the full dataset. Q1 is exactly the 25th percentile: 25% of values lie below it. Q3 is the 75th percentile: 75% of values lie below it. The IQR spans from the 25th to the 75th percentile — the middle two quartile groups combined, covering exactly half the dataset.
As described in the OpenStax Introductory Statistics textbook (a peer-reviewed open resource), quartiles are a foundational tool in the five-number summary (minimum, Q1, median, Q3, maximum) and directly drive the construction of box-and-whisker plots. The relationship between percentiles and quartiles is also covered in Penn State's STAT 200 course notes.
The Interquartile Range Formula
IQR Formula Explained Simply
IQR = interquartile range
Q1 = first quartile (25th percentile)
Q3 = third quartile (75th percentile)
Q3 − Q1 = the width of the central 50% of data
What Q1 and Q3 Mean in the Formula
Q3 marks the point where the upper 25% of values begin. Q1 marks the point where the lower 25% of values end. Everything between them — 50% of all data — falls inside the IQR. Subtracting Q1 from Q3 gives the total width of that central region.
Why We Subtract Q1 from Q3
The subtraction is a distance calculation. Imagine plotting Q1 and Q3 on a number line: the IQR is simply the gap between them, the same way range is the gap between minimum and maximum. The difference is that range uses the two most extreme points, while IQR deliberately ignores the extremes and focuses only on the middle span.
| Symbol | Meaning | Position in Data |
|---|---|---|
| Q1 | First quartile — median of the lower half of data | 25th percentile |
| Q2 | Median — middle value of the full dataset | 50th percentile |
| Q3 | Third quartile — median of the upper half of data | 75th percentile |
| IQR | Interquartile range = Q3 − Q1 | Covers 25th–75th percentile |
How to Find the Interquartile Range — Step-by-Step
Step 1: Sort data from smallest to largest. Step 2: Find the median (Q2). Step 3: Find Q1 — the median of the lower half. Step 4: Find Q3 — the median of the upper half. Step 5: Subtract: IQR = Q3 − Q1.
Worked Example 1 — Student Test Scores (Odd Number of Data Points)
Nine students score: 52, 74, 61, 88, 45, 79, 93, 67, 70. Find the IQR.
Sort ascending: 45, 52, 61, 67, 70, 74, 79, 88, 93
Find Q2 (median): With 9 values, the median is the 5th value = 70. This splits data into a lower half (45, 52, 61, 67) and an upper half (74, 79, 88, 93). When n is odd, exclude the median from both halves.
Find Q1 (median of lower half: 45, 52, 61, 67): With 4 values, the median is the average of the 2nd and 3rd: (52 + 61) / 2 = 56.5
Find Q3 (median of upper half: 74, 79, 88, 93): Average of 2nd and 3rd: (79 + 88) / 2 = 83.5
Calculate IQR: 83.5 − 56.5 = 27
✓ IQR = 27 points. The middle 50% of students scored within a 27-point range of each other. At Q1 = 56.5 and Q3 = 83.5, the central half of the class spans from roughly a D+ to a B. That tells you more about the class distribution than the full range of 48 (93 − 45) does, because that range reflects only the two extremes.
Worked Example 2 — Employee Salaries (Even Number of Data Points)
Ten employees earn (in thousands): 38, 42, 47, 55, 59, 63, 72, 78, 85, 91. Find the IQR.
Data already sorted: 38, 42, 47, 55, 59, 63, 72, 78, 85, 91
Find Q2 (median): With 10 values, the median is the average of the 5th and 6th: (59 + 63) / 2 = 61. The lower half is {38, 42, 47, 55, 59} and the upper half is {63, 72, 78, 85, 91}. With an even n, each half gets exactly n/2 values.
Find Q1 (median of lower half: 38, 42, 47, 55, 59): 5 values — the 3rd value = 47
Find Q3 (median of upper half: 63, 72, 78, 85, 91): 5 values — the 3rd value = 78
Calculate IQR: 78 − 47 = $31,000
✓ IQR = $31,000. The middle half of employees earns within a $31,000 band — from $47K to $78K. This is the most informative single number describing compensation spread for typical employees at this company. The full range of $53,000 (38 to 91) is pulled wide by the lowest and highest earners.
When n is odd, the median (Q2) is a single middle value. The standard approach (used by most statistics textbooks and software) is to exclude the median from both the lower and upper halves when finding Q1 and Q3. This is the "exclusive method." Some curricula use the "inclusive method" and include the median. Both are mathematically defensible — check which method your textbook or software uses. R's default (type 7), Python's numpy default (linear interpolation), and Excel's QUARTILE.EXC all handle this differently.
Interquartile Range Examples — Real Datasets
Example 3 — Housing Prices (Skewed Data)
House prices in a neighborhood ($000s): 185, 210, 225, 240, 265, 280, 310, 890. Find the IQR and explain what it shows.
Sorted: 185, 210, 225, 240, 265, 280, 310, 890
Q2 (median): (240 + 265) / 2 = $252,500. Lower half: {185, 210, 225, 240}. Upper half: {265, 280, 310, 890}.
Q1: Median of {185, 210, 225, 240} = (210 + 225) / 2 = $217,500
Q3: Median of {265, 280, 310, 890} = (280 + 310) / 2 = $295,000
IQR: $295,000 − $217,500 = $77,500
✓ IQR = $77,500. The middle half of homes in this neighborhood sells within a $77,500 range — from $217,500 to $295,000. By contrast, the full range is $705,000 (890 − 185), almost entirely because one home sold for $890K. The IQR tells the story of the typical house in this market; the range tells the story of the outlier.
Example 4 — Sports Performance Data
Points scored by a basketball player in 12 games: 8, 12, 14, 15, 16, 18, 19, 21, 24, 26, 30, 44. Find the IQR.
Sorted (already): 8, 12, 14, 15, 16, 18, 19, 21, 24, 26, 30, 44
Q2 (median): (18 + 19) / 2 = 18.5. Lower half: {8, 12, 14, 15, 16, 18}. Upper half: {19, 21, 24, 26, 30, 44}.
Q1: Median of {8, 12, 14, 15, 16, 18} = (14 + 15) / 2 = 14.5
Q3: Median of {19, 21, 24, 26, 30, 44} = (24 + 26) / 2 = 25
IQR: 25 − 14.5 = 10.5 points
✓ IQR = 10.5 points. In a typical game, this player scores somewhere in the range from about 14.5 to 25 points — a 10.5-point spread for the central half of their performances. The 44-point outlier game inflates the range to 36 but doesn't affect the IQR at all.
How to Interpret the Interquartile Range
What Does a Large IQR Mean?
A large IQR means the middle 50% of values span a wide range — the data is highly variable. In the salary example above, an IQR of $31,000 may seem large or small depending on the industry. A national study of 500 software engineers might show IQR = $45,000; a group of hourly warehouse workers might show IQR = $4,200. Those are two completely different spreads, and interpreting IQR always requires context.
What Does a Small IQR Mean?
A small IQR means the central half of values cluster tightly together. Manufacturing quality control data often shows a small IQR — if you are producing bolts that are supposed to be exactly 10mm, a small IQR confirms that most bolts land in a narrow band. A wider IQR signals inconsistency that may require process adjustment.
How to Compare IQR Across Two Datasets
Side-by-Side Comparison
Dataset A: IQR = 5 | Dataset B: IQR = 40
Dataset A has Q1 = 48 and Q3 = 53 — its central half spans only 5 units. Dataset B has Q1 = 30 and Q3 = 70 — its central half spans 40 units. Both datasets could have the same median of 50. A data analyst seeing Dataset A knows the typical values are predictable and consistent. A data analyst seeing Dataset B knows there is wide variation in typical performance — the dataset includes both high and low performers in roughly equal measure.
IQR and Skewed Data — Why Spread Looks Different
When data is skewed, the mean and standard deviation are pulled toward the tail, misrepresenting the typical center. The IQR (paired with the median) is the preferred summary for skewed distributions. Income data, home prices, medical expenses, and insurance claims are all examples of right-skewed data where the IQR gives a more accurate picture of what "typical" looks like than the mean and SD would.
Interactive IQR Calculator
Interquartile Range Calculator
Using IQR to Find Outliers — The 1.5×IQR Rule
What Is an Outlier?
An outlier is a data point that sits far enough from the bulk of the data that it may represent a measurement error, a genuinely unusual case, or an extreme event worth investigating separately. In descriptive statistics, outliers can distort measures like the mean and range, which is why identifying them matters before analysis.
The Outlier Formula Using IQR
Why 1.5? Tukey's Convention Explained
The multiplier 1.5 was chosen by statistician John Tukey in his 1977 book Exploratory Data Analysis — the foundational text for box plots and data exploration methods. Tukey observed that for data following a normal distribution, the fences at 1.5×IQR mark approximately ±2.7 standard deviations from the mean, which flags about 0.7% of values as outliers — a range he judged to be the right balance between sensitivity and specificity. Using 3×IQR instead catches only the most extreme values, equivalent to approximately ±4 standard deviations.
A data point outside the fence is flagged as a potential outlier — not automatically deleted. A $890K house in a neighborhood where most homes cost $200K–$300K is a genuine outlier, but it is a real sale, not a mistake. Context determines whether you remove, keep, or annotate an outlier. Always investigate before excluding.
Worked Example — Finding Outliers in a Dataset
Call center daily tickets resolved: 42, 45, 48, 51, 53, 55, 57, 60, 63, 98. Are any values outliers?
Sorted: 42, 45, 48, 51, 53, 55, 57, 60, 63, 98
Q2: (53 + 55) / 2 = 54. Lower half: {42, 45, 48, 51, 53}. Upper half: {55, 57, 60, 63, 98}.
Q1: Median of {42, 45, 48, 51, 53} = 48
Q3: Median of {55, 57, 60, 63, 98} = 60
IQR: 60 − 48 = 12
Lower Fence: 48 − (1.5 × 12) = 48 − 18 = 30. No values below 30. ✓
Upper Fence: 60 + (1.5 × 12) = 60 + 18 = 78. The value 98 exceeds 78. → 98 is an outlier.
✓ One outlier detected: 98 tickets. This agent resolved 35 more tickets than the upper fence in a single day — worth investigating for exceptional performance or a data entry error. Every other day falls within the normal operating range of 30–78 tickets.
IQR and the Box-and-Whisker Plot
How the IQR Is Visualized in a Box Plot
The box in a box-and-whisker plot is the IQR. The left edge of the box lands at Q1; the right edge lands at Q3. The line inside the box marks Q2 (the median). The box's total width is the IQR — the larger the box, the more spread the central data. Whiskers extend from Q1 and Q3 outward to the most extreme non-outlier values within the fences. Individual dots beyond the whiskers mark outliers.
Box Plot Anatomy — Where IQR Appears
The shaded box spans Q1 to Q3 — that is the IQR. The center line is the median. Whiskers reach the most extreme non-outlier values. Points beyond the whiskers are outliers.
Reading a Box Plot — The Five-Number Summary
Every box plot encodes the five-number summary: minimum, Q1, Q2 (median), Q3, and maximum. From those five numbers — all derivable once you have the IQR — you can reconstruct the full shape of a distribution. The OpenStax Introductory Statistics textbook describes the five-number summary as the standard way to describe a dataset's distribution when the data is not symmetric (OpenStax Chapter 2).
| Component | Value (Salary Example) | Box Plot Position |
|---|---|---|
| Minimum | $38,000 | End of left whisker |
| Q1 (First Quartile) | $47,000 | Left edge of box |
| Q2 / Median | $61,000 | Line inside box |
| Q3 (Third Quartile) | $78,000 | Right edge of box |
| Maximum (non-outlier) | $91,000 | End of right whisker |
| IQR = Q3 − Q1 | $31,000 (width of box) | |
IQR vs. Range — What's the Difference?
How Range Is Calculated
The range is the simplest measure of spread: Range = Maximum − Minimum. For the salary data above, the range is $91,000 − $38,000 = $53,000. For the housing example, Range = $890,000 − $185,000 = $705,000. Both take exactly two data points and ignore the other n − 2 values entirely.
Why Range Is Sensitive to Outliers
Consider these two datasets, each with 8 values:
| Metric | Dataset A: 10, 12, 13, 14, 15, 16, 17, 18 | Dataset B: 10, 12, 13, 14, 15, 16, 17, 95 |
|---|---|---|
| Range | 18 − 10 = 8 | 95 − 10 = 85 |
| Q1 | 12 | 12 |
| Q3 | 16.5 | 16.5 |
| IQR | 4.5 | 4.5 |
Datasets A and B differ by only one value (18 vs. 95). The range changes from 8 to 85 — a tenfold jump. The IQR stays at 4.5 because the single extreme value sits in the top 25% of data that IQR ignores. The IQR correctly communicates that typical spread in both datasets is the same.
When to Use IQR Instead of Range
Use IQR when your dataset contains potential outliers, when the distribution is skewed, or when you are reporting alongside the median. Use range only when you need the full span of the data (e.g., the operating temperature range of an engine), and when all values in the dataset are legitimate and carry equal interpretive weight.
IQR vs. Standard Deviation — When to Use Each
What Standard Deviation Measures
Standard deviation (SD) measures the average distance of every data point from the mean. It uses all n values, squares the deviations, and takes the square root of the average. Because it uses the mean and accounts for all values, it is sensitive to outliers — one extreme value increases both the mean and the deviations from it, inflating the SD.
| Property | IQR | Standard Deviation |
|---|---|---|
| What it measures | Spread of middle 50% | Avg. distance of all values from the mean |
| Sensitive to outliers? | No (robust) | Yes (non-robust) |
| Paired statistic | Median | Mean |
| Preferred for skewed data | ✓ Yes | ✗ Not ideal |
| Preferred for normal data | Works, but SD uses all data | ✓ Yes |
| Uses all data points | No (uses Q1 and Q3 only) | Yes (uses all n values) |
| Appears in box plots | ✓ Yes (the box) | No |
If data is symmetric and approximately normal → use mean and standard deviation. If data is skewed or contains outliers → use median and IQR. When in doubt, report both: a complete picture uses the five-number summary and the mean/SD together. The NIST Handbook recommends checking for outliers with IQR before deciding which summary statistics to report (NIST §3.1.3.5).
For related concepts, see Variance, which is the squared version of standard deviation, and Z-Score, which uses standard deviation to express how far a value lies from the mean in standardized units.
IQR in Excel, Python, and R
How to Find IQR in Excel
Excel does not have a single IQR function. You calculate it using QUARTILE.EXC (exclusive method, which matches most textbooks) or QUARTILE.INC (inclusive method):
=QUARTILE.EXC(A1:A20, 1) // Q1
=QUARTILE.EXC(A1:A20, 3) // Q3
=QUARTILE.EXC(A1:A20, 3) - QUARTILE.EXC(A1:A20, 1) // IQR
// Outlier fences
=QUARTILE.EXC(A1:A20, 1) - 1.5 * (QUARTILE.EXC(A1:A20, 3) - QUARTILE.EXC(A1:A20, 1)) // Lower Fence
=QUARTILE.EXC(A1:A20, 3) + 1.5 * (QUARTILE.EXC(A1:A20, 3) - QUARTILE.EXC(A1:A20, 1)) // Upper Fence
How to Find IQR in Python
from scipy import stats
data = [45, 52, 61, 67, 70, 74, 79, 88, 93]
# Method 1: numpy percentile
Q1 = np.percentile(data, 25)
Q3 = np.percentile(data, 75)
IQR = Q3 - Q1
# Method 2: scipy (recommended — uses linear interpolation)
IQR = stats.iqr(data)
lower_fence = Q1 - (1.5 * IQR)
upper_fence = Q3 + (1.5 * IQR)
print(f"Q1={Q1}, Q3={Q3}, IQR={IQR}")
print(f"Lower fence: {lower_fence}, Upper fence: {upper_fence}")
How to Find IQR in R
Q1 <- quantile(data, 0.25)
Q3 <- quantile(data, 0.75)
IQR_val <- IQR(data) # R has a built-in IQR() function
lower_fence <- Q1 - (1.5 * IQR_val)
upper_fence <- Q3 + (1.5 * IQR_val)
# Create box plot (R automatically uses IQR for whiskers)
boxplot(data, main="Box Plot with IQR", horizontal=TRUE)
summary(data) # Gives Min, Q1, Median, Mean, Q3, Max
numpy.percentile(data, 25, interpolation='midpoint'). These differences are small and do not change interpretation.
Where IQR Is Used in Practice
Clinical Research
Medical studies report IQR when presenting patient data (age, lab values, dosages) that is not normally distributed. "Median age 54 years (IQR: 46–63)" is standard in journals such as NEJM and JAMA.
Finance & Economics
Income distribution, housing prices, and asset valuations are right-skewed. Economists use IQR to describe the middle of the income spectrum without the mean being dragged up by the very wealthy.
Quality Control
Manufacturing processes monitor IQR of product measurements. A narrowing IQR over time signals that process variability is decreasing — a key goal in Six Sigma and Statistical Process Control (SPC).
Education & Testing
Standardized test score reports use IQR alongside the median to show where most students scored — a more useful picture for teachers than the mean when a few very low scores pull the average down.
Glossary — Key IQR and Descriptive Statistics Terms
| Term | Formula / Notation | Plain-English Definition | Common Mistake |
|---|---|---|---|
| IQR | Q3 − Q1 | The range covered by the middle 50% of sorted data | Confused with the full range (max − min) |
| Q1 (First Quartile) | 25th percentile | The median of the lower half of the data; 25% of values fall below it | Miscalculated when n is even — Q1 is the median of the lower n/2 values |
| Q2 (Median) | 50th percentile | The middle value; half the data lies above and half below | Forgetting to sort before finding the median |
| Q3 (Third Quartile) | 75th percentile | The median of the upper half of the data; 75% of values fall below it | Students confuse Q3 with the upper fence |
| Five-Number Summary | Min, Q1, Q2, Q3, Max | Five values that fully describe a dataset's distribution; basis for box plots | Forgetting that sorted data is required before any of these can be found |
| Lower Fence | Q1 − (1.5 × IQR) | The threshold below which a data point is flagged as an outlier | Confused with the minimum of the dataset |
| Upper Fence | Q3 + (1.5 × IQR) | The threshold above which a data point is flagged as an outlier | Confused with the maximum of the dataset |
| Outlier | < lower fence or > upper fence | A data point unusually far from the rest of the data by the 1.5×IQR rule | Assuming all outliers are errors — they may be genuine extreme values |
| Range | Max − Min | Total span of the data from smallest to largest value | Using range as a sole measure of spread — one outlier completely changes it |
| Robust Statistic | — | A statistic not strongly influenced by outliers; the median and IQR are both robust | "Robust" in statistics ≠ "more accurate" — it means resistant to extreme values |
Common IQR Mistakes
| Mistake | What People Do Wrong | Correct Approach |
|---|---|---|
| Forgetting to sort | Finding the median of unsorted data (e.g., calling the 5th element the median without sorting first) | Always arrange data smallest to largest before locating any quartile or median |
| Median in both halves (odd n) | Including the median value in both the lower and upper halves when calculating Q1 and Q3 | When n is odd, exclude the median from both halves (standard exclusive method used by most software) |
| IQR = range | Calculating IQR as max − min | IQR = Q3 − Q1, not max − min. Range and IQR are different measures |
| Confusing Q3 with the upper fence | Calling Q3 the "outlier cutoff" without applying the 1.5× multiplier | Upper fence = Q3 + (1.5 × IQR). Q3 itself is not a fence |
| Deleting outliers automatically | Removing every value that falls outside the fence without investigating why | Flag outliers, then investigate. Genuine extreme values carry real information |
| Using IQR with the mean | Reporting "mean = 54, IQR = 18" as paired summary statistics | Pair IQR with the median, not the mean. "Median = 52 (IQR: 45–63)" is the correct format |
Frequently Asked Questions About IQR
What does the interquartile range tell you?
The IQR tells you how spread out the middle 50% of a dataset is. A small IQR means the central values are tightly clustered; a large IQR means they are widely spread. Because IQR ignores the bottom 25% and top 25% of values, it is not distorted by outliers — which makes it a reliable measure of typical variability in real-world data.
What is considered an outlier using IQR?
By Tukey's 1.5×IQR rule, any data point below Q1 − (1.5 × IQR) or above Q3 + (1.5 × IQR) is a potential outlier. Values beyond 3×IQR from the quartiles are classified as extreme outliers. This rule was established in John Tukey's Exploratory Data Analysis (1977) and is the standard in most statistical software, including R's boxplot() function.
Why is IQR better than range?
Range uses only the two most extreme data points and is completely controlled by outliers. One unusually large or small value can make the range enormous while every other value in the dataset is tightly packed. IQR focuses on the middle 50%, so a single outlier has no effect on it. This makes IQR a more honest description of typical data spread when outliers exist.
What is the difference between IQR and standard deviation?
IQR is the spread of the middle 50% of data; standard deviation is the average distance of every data point from the mean. IQR is a robust statistic (not affected by outliers); SD is not robust and increases when outliers are present. Use IQR for skewed data or data with outliers. Use SD for approximately normal data where the mean is a sensible center.
Where is the IQR shown on a box plot?
The IQR is the length of the box in a box-and-whisker plot. The left edge of the box is at Q1; the right edge is at Q3. The box's total width equals Q3 − Q1 = IQR. The line inside the box marks the median (Q2). Whiskers extend from the box edges to the most extreme non-outlier values within the fences.
When should you use IQR instead of standard deviation?
Use IQR when: the data is not normally distributed (skewed or heavy-tailed); the dataset contains known or suspected outliers; you are reporting alongside the median; or you are drawing box-and-whisker plots. Standard deviation is the better choice when data is approximately symmetric and normal, and when you want every data point to contribute to the measure of spread.
Ready to go further? The IQR connects directly to standard deviation, variance, and the mean. Once you understand data spread, the natural next steps are normal distribution, z-scores, and hypothesis testing. Use the descriptive statistics calculator to get IQR, mean, median, and SD for your own dataset in one click.