The interquartile range (IQR) is the difference between the third quartile (Q3) and the first quartile (Q1) of a sorted data set, and it measures how spread out the middle 50 percent of your values are. What is the interquartile range useful for that other spread measures aren’t? It ignores the extreme high and low values entirely, which makes it the spread statistic of choice whenever a data set might contain outliers or a skewed tail. This guide covers the IQR formula, shows you how to find the interquartile range by hand with a worked example, and pinpoints exactly where it beats — and where it loses to — the range and the standard deviation.

Key takeaways

Point Details
IQR = Q3 − Q1 Subtract the first quartile from the third quartile; the result is the width of the middle 50 percent of a sorted data set.
It ignores the top and bottom quarters entirely Q1 and Q3 are computed from the inner portion of the data, so a single extreme value cannot move the IQR at all.
Finding it is a two-step median split Find the overall median, split the data into a lower and upper half around it, then find the median of each half — those are Q1 and Q3.
It is the backbone of the boxplot The box in a box-and-whisker plot runs from Q1 to Q3, so its width is literally the IQR.
Software can disagree by a little Excel, R, and Python use different quartile algorithms, so the same data set can return slightly different Q1/Q3 values depending on the tool.

Quick Checklist: How to Find the Interquartile Range

Most wrong answers trace back to one of these steps being skipped or done out of order. Run through this before you trust a result.

Quick checklist: finding the interquartile range

  • Sort the data first Quartiles only make sense on values arranged from smallest to largest.
  • Find the median (Q2) The middle value for an odd count, or the average of the two middle values for an even count.
  • Split into a lower and upper half Exclude the median itself from both halves when the count is odd.
  • Find the median of each half The lower half’s median is Q1; the upper half’s median is Q3.
  • Subtract: IQR = Q3 − Q1 The result should always be zero or positive — a negative answer means Q1 and Q3 were swapped.

Calculate the Interquartile Range

Enter your own list of numbers and the calculator below returns the minimum, maximum, Q1, median, Q3, and the IQR instantly.

Calculator

Range / IQR Calculator

Enter values and compute the result.

What Is the Interquartile Range?

The interquartile range is a measure of statistical dispersion built from two specific values in a sorted data set: the first quartile (Q1) and the third quartile (Q3). Quartiles divide sorted data into four equal quarters, and the NIST/SEMATECH e-Handbook of Statistical Methods defines the interquartile range plainly as “the value of the 75th percentile minus the value of the 25th percentile,” adding that this measure of scale “attempts to measure the variability of points near the center.”

  • Q1 (first quartile): the value below which 25 percent of the data falls.
  • Q2 (second quartile): the median — half the values lie below it.
  • Q3 (third quartile): the value below which 75 percent of the data falls.
IQR = Q3 − Q1

Because Q1 marks the bottom of the middle half and Q3 marks the top, the IQR spans the central 50 percent of the data and says nothing at all about the outer quarters on either end. Quartiles are a specific case of percentiles — Q1 is the 25th percentile and Q3 is the 75th — so the percentiles guide is the place to go for how percentile ranks work more generally; this page focuses on what happens once you land on exactly those two.

What Is the IQR Formula?

So what is interquartile range, arithmetically speaking? One subtraction:

IQR = Q3 − Q1

The result carries the same units as the original data: an IQR of 8 minutes means the middle half of your measurements spans 8 minutes. The arithmetic is trivial — the real work is locating Q1 and Q3 correctly, and that’s where methods diverge. R’s quantile() documentation lists nine distinct sample-quantile algorithms (selected with its type argument, defaulting to type 7), and NumPy’s percentile() function offers a matching set of interpolation methods, with linear as the default. The step-by-step median-split method below is the version most commonly taught in introductory statistics courses, and it’s what this guide uses throughout; expect small differences if you check a result against a spreadsheet or statistical package, especially on a small sample.

How Do You Find the Interquartile Range?

Here’s how to find interquartile range by hand, in five steps: sort the data, find the median, split the data at the median, find the median of each half, then subtract.

Step 1: Sort the data from smallest to largest

Arrange every value in ascending order. Skipping this step guarantees a wrong Q1 and Q3.

Step 2: Find the median (Q2)

Count the values. If the count is odd, Q2 is the single middle value. If it is even, Q2 is the average of the two middle values.

Step 3: Split the data at the median

Divide the sorted values into a lower half and an upper half. When the total count is odd, exclude the median itself from both halves. When the count is even, the two middle values each belong to their own half, with no exclusion needed.

Step 4: Find Q1 and Q3

Q1 is the median of the lower half; Q3 is the median of the upper half. Apply the same rule from Step 2 to each half.

Step 5: Subtract Q1 from Q3

IQR = Q3 − Q1

A Worked Example: Spread in Weekly Sales Calls

A sales manager wants to know how consistent call volume was across the team last week, before deciding whether to flag the spread as a problem. Nine reps logged these call counts: 14, 19, 22, 25, 27, 29, 31, 35, 42 (already sorted, n = 9).

Step 1 — Data is already sorted: 14, 19, 22, 25, 27, 29, 31, 35, 42
Step 2 — Median (Q2): position 5 of 9 → Q2 = 27
Step 3 — Lower half (exclude 27): 14, 19, 22, 25
          Upper half (exclude 27): 29, 31, 35, 42
Step 4 — Q1 = median(14, 19, 22, 25) = (19 + 22) / 2 = 20.5
          Q3 = median(29, 31, 35, 42) = (31 + 35) / 2 = 33
Step 5 — IQR = 33 − 20.5 = 12.5

The interquartile range is 12.5 calls. The middle half of the reps’ weekly call counts spans 12.5 calls, while the overall range is 42 − 14 = 28 — more than twice as wide, because the range also counts the two most extreme reps that the IQR deliberately excludes.

Decision. The manager should report the median (27 calls) and the IQR (12.5 calls) as the headline spread figures for this team, not the range — a 28-call range sounds like a wide spread, but the IQR shows the middle 50 percent of reps cluster within 12.5 calls of each other, which is a much more defensible read of “typical” performance. The next section shows exactly why that choice holds up even if one rep’s count turns out to be unusual.

Paste these nine values into the calculator above to confirm Q1, Q3, and the IQR without redoing the median splits by hand.

Why Does the IQR Resist Outliers?

The IQR is a resistant statistic: extreme values at either end of a sorted data set cannot move it, because Q1 and Q3 are computed from the inner portion of the data, not the extremes. Replace the largest value in the worked example — 42 — with an outlier of 95:

Modified data: 14, 19, 22, 25, 27, 29, 31, 35, 95
Median: still 27 (position 5 of 9, unchanged)
Lower half: 14, 19, 22, 25 → Q1 = 20.5 (unchanged)
Upper half: 29, 31, 35, 95 → Q3 = median(29, 31, 35, 95) = 33 (unchanged)
IQR = 33 − 20.5 = 12.5  (identical to the original)

The range, by contrast, leaps from 28 to 81 (95 − 14) — nearly triple. The IQR holds steady at 12.5 because 95 sits outside the middle 50 percent entirely, so it plays no role in determining either quartile.

Range vs. IQR before and after an outlier Bar chart comparing the range before and after an outlier is introduced, against the unchanged IQR: range of 28 for the original nine reps, range of 81 after one value is replaced with 95, and an IQR of 12.5 in both cases. 0 26.32 52.65 78.97 105.3 28 Range,original data 81 42 replaced with 95 Range, withoutlier 12.5 Unchanged IQR, bothdata sets
Figure 1. Replacing the largest value (42) with an outlier (95) nearly triples the range, from 28 to 81, while the IQR stays fixed at 12.5.

This resistance is exactly why the IQR anchors the box in a box-and-whisker plot. NIST/SEMATECH’s box plot reference describes the construction directly: plot the median, then “draw a box between the lower and upper quartiles” — so the box’s width is the IQR by definition — and it is why the IQR also powers the standard rule for flagging outliers in the first place. The NIST/SEMATECH e-Handbook’s guidance on outlier detection builds exactly this kind of fence from the IQR: a lower inner fence at Q1 − 1.5×IQR and an upper inner fence at Q3 + 1.5×IQR, with points beyond an outer fence at 3×IQR flagged as extreme outliers. OpenStax’s Introductory Statistics 2e, Section 2.3 sets the same rule in plainer terms: “A value is suspected to be a potential outlier if it is less than (1.5)(IQR) below the first quartile or more than (1.5)(IQR) above the third quartile.” For the full mechanics of applying that rule — including how to compute the fences and decide what to do with a flagged point — see the outlier detection guide; for how the box and whiskers are drawn from these same numbers, see the histogram vs. boxplot guide.

When Should You Use the IQR Instead of the Range or Standard Deviation?

Reach for the IQR whenever a data set might contain outliers or a skewed tail and you want a spread measure that describes what’s typical rather than what’s extreme. Reach for the range only for a fast, disposable first pass, and reach for the standard deviation when you need a measure built from every value and your data don’t have extreme outliers distorting it.

Choosing a spread measure by what you need
Measure What it uses Resistant to outliers? Best for
Range Only the max and min No A quick, disposable first pass
Interquartile range (IQR) The middle 50% of values Yes Skewed data or data with outliers
Standard deviation Every value, via distance from the mean No Symmetric data without extreme outliers

For the full worked comparison on a single data set — including how a single outlier moves the range and standard deviation while barely touching the IQR — see the range guide, which runs the same kind of before-and-after test with its own numbers. The short version: on the worked example above, the standard deviation of the original nine values is about 8.4 calls, but it jumps to about 24.1 once the 95-call outlier replaces 42 — a swing almost as sharp as the range’s, while the IQR didn’t move at all.

The range is the largest value minus the smallest value in a data set. Note that this measure is based only on the lowest and highest extreme values in the sample. The spread near the center of the data is not captured at all.

NIST/SEMATECH e-Handbook of Statistical Methods

How Do You Calculate the IQR in Excel, R, or Python?

All three tools can return a different Q1 and Q3 than the median-split method above, because each one defaults to a different quartile algorithm. Running the nine call counts (14, 19, 22, 25, 27, 29, 31, 35, 42) through each tool’s default makes the gap concrete.

Excel:  =QUARTILE.INC(A1:A9, 3) - QUARTILE.INC(A1:A9, 1)
        → Q1 = 22, Q3 = 31, IQR = 9

R:      calls = c(14, 19, 22, 25, 27, 29, 31, 35, 42)
        IQR(calls)                       # uses quantile(type = 7) by default → 9

Python: import statistics
        calls = [14, 19, 22, 25, 27, 29, 31, 35, 42]
        statistics.quantiles(calls, n=4)                  # exclusive (default) → [20.5, 27, 33], IQR = 12.5
        statistics.quantiles(calls, n=4, method='inclusive')  # → [22, 27, 31], IQR = 9

Excel’s QUARTILE.INC function, NumPy’s percentile() with its default linear method, and R’s IQR() function, which computes quartiles via quantile() with type = 7 by default, all agree with each other on this data set: Q1 = 22, Q3 = 31, IQR = 9 — not the 12.5 the median-split method produced above. R’s own documentation is explicit about the mismatch, noting that IQR() “computes the quartiles using the quantile function rather than following Tukey’s recommendations.” Python breaks the pattern: the standard library’s statistics.quantiles() defaults to method='exclusive', which reproduces the median-split answer of 12.5 exactly — switch it to method='inclusive' and it matches Excel and R instead. SciPy’s scipy.stats.iqr() exposes the same interpolation parameter if you need to match a specific convention there too.

What Mistakes Do People Make When Calculating the IQR?

  • Forgetting to sort the data. Quartile calculations require ascending order; applying the steps to unsorted data produces a Q1 and Q3 that mean nothing.
  • Including the median in both halves. When n is odd, the median is a single data point and must be excluded from both the lower and upper halves before finding Q1 and Q3. Including it inflates one quartile and deflates the other.
  • Reversing Q1 and Q3. Q1 is always the smaller quartile and Q3 the larger one, so IQR = Q3 − Q1 is always zero or positive. A negative result means the two were swapped.
  • Assuming every tool agrees. As the comparison above shows, the median-split method and the default linear-interpolation method built into Excel, R, and Python can return noticeably different Q1 and Q3 values on the same small data set, even though every calculation is implemented correctly.
  • Treating the IQR as a percentage. The IQR is an absolute measure in the same units as the data. An IQR of 8 points is a spread of 8 points, not 8 percent.
  • Reporting a single IQR without stating the method. State which quartile method produced your Q1 and Q3, especially on a small data set where — as the comparison above shows — the choice of method visibly changes the answer, so a reader or grader can reproduce your number exactly.

Statohub’s Take on the Interquartile Range

Statohub’s position is that the IQR deserves to be the default spread statistic the moment a data set might contain outliers, a skewed tail, or values you haven’t fully audited yet — which, in practice, describes most real-world data. The range is faster and the standard deviation is more familiar, but neither one tells you what “typical” looks like once a handful of extreme values are in the mix. Report the median and IQR together, and reach for the mean and standard deviation only once you’ve checked that the extremes aren’t quietly running the show.

Put the Interquartile Range to Work With Statohub’s Tools

The calculator above handles Q1, Q3, and the IQR for any list you paste in — for a standalone version with percentile rank included, try the percentile calculator. To round out the rest of the spread picture, the standard deviation guide and the variance guide cover the measures that use every value instead of just the middle half, and the range guide walks through the simplest spread statistic of all. The Descriptive Statistics hub ties mean, median, mode, range, variance, and the IQR together in one place, and the full calculators hub has every tool on the site.

Sources

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods — 1.3.5.6. Measures of Scale NIST
  2. NIST/SEMATECH e-Handbook of Statistical Methods — 7.1.6. What Are Outliers in the Data? NIST
  3. NIST/SEMATECH e-Handbook of Statistical Methods — 1.3.3.7. Box Plot NIST
  4. OpenStax — 2.3 Measures of the Location of the Data, Introductory Statistics 2e OpenStax
  5. Microsoft Support — QUARTILE.INC function Microsoft
  6. NumPy — numpy.percentile NumPy
  7. R Documentation — quantile (Sample Quantiles) The R Project
  8. R Documentation — IQR (The Interquartile Range) The R Project
  9. SciPy — scipy.stats.iqr SciPy
  10. Python Software Foundation — statistics.quantiles, Python documentation Python Software Foundation

FAQ

Frequently asked questions

What Is the Interquartile Range?
The interquartile range is the difference between the third quartile (Q3) and the first quartile (Q1) of a sorted data set: IQR = Q3 − Q1. It measures the spread of the middle 50 percent of the data and is not influenced by extreme values at either end, which is what makes it more reliable than the range when outliers are a possibility.
How Do You Find Interquartile Range for an Even Number of Values?
The process is the same, but finding the median (Q2) works differently: for an even count, Q2 is the average of the two middle values, and the full sorted list splits exactly in half with no value excluded from either side (since the median isn’t one specific data point). Then find the median of the lower half for Q1 and the median of the upper half for Q3, and subtract as usual.
Why Does the IQR Not Change When an Outlier Is Added?
Q1 and Q3 are calculated from the inner portion of a sorted data set, not the extremes. Adding or changing a value at the far end of the distribution shifts only the maximum or minimum, leaving the positions of the 25th and 75th percentile values — and therefore the IQR — unchanged, regardless of how extreme the new value is.
What Is the IQR Formula Used For?
Beyond describing spread, the IQR formula anchors the box in a box-and-whisker plot (the box spans Q1 to Q3) and sets the fences for the standard 1.5×IQR outlier rule. It is also used to compare variability between groups when a standard deviation comparison would be thrown off by outliers in one of the groups.
How Does the IQR Differ From the Range?
The range (maximum minus minimum) uses only two values and is highly sensitive to outliers. The IQR (Q3 minus Q1) uses the middle 50 percent of the data and is resistant to outliers. Both report spread in the same units as the data, but the IQR is the more trustworthy choice whenever extreme values or skew are a real possibility.