Interquartile Range Formula (Q3 minus Q1) Examples

#Formula
TL;DR
The interquartile range formula subtracts the first quartile from the third, IQR=Q3−Q1\text{IQR} = Q_3 - Q_1. This article gives the quartile method, five worked examples, and the common errors.
BT
Bhanzu TeamLast updated on November 4, 20268 min read

Key Points

  • The interquartile range formula is IQR=Q3−Q1\text{IQR} = Q_3 - Q_1, the distance between the third and first quartiles.

  • The NIST e-Handbook of Statistical Methods defines the interquartile range as the value of the 75th percentile minus the value of the 25th percentile.

  • The IQR spans the middle 50 per cent of the data, so it ignores the smallest quarter and the largest quarter entirely.

  • Because it discards both tails, the interquartile range is unaffected by extreme values in a way the full range never is.

  • The NIST e-Handbook builds its outlier fences from the IQR, placing inner fences 1.5 times the IQR beyond each quartile.

What Is the Interquartile Range Formula?

The interquartile range formula measures the spread of the middle half of a data set, and is written

IQR=Q3−Q1\text{IQR} = Q_3 - Q_1

where Q1Q_1 is the first quartile and Q3Q_3 the third. The NIST/SEMATECH e-Handbook of Statistical Methods states that the difference Q3−Q1Q_3 - Q_1 is called the interquartile range.

The Full Definition

Quartiles cut an ordered data set into four parts of equal count. Q1Q_1 sits where a quarter of the values lie below it, Q2Q_2 is the median, and Q3Q_3 sits where three quarters lie below it.

The interquartile range is the width of the block between Q1Q_1 and Q3Q_3. Half the observations fall inside it, a quarter below it and a quarter above it.

That construction is the whole point. By measuring only the central half, the IQR reports a spread that the most extreme values cannot influence at all.

How NIST Locates the Quartiles

Quartiles are not quite as settled as they look, because there is more than one convention for locating them. The NIST e-Handbook's worked example takes Q1Q_1 at the 0.25(N+1)0.25(N+1)th ordered point and Q3Q_3 at the 0.75(N+1)0.75(N+1)th ordered point, interpolating when that position falls between two values.

For N=11N = 11, that puts Q1Q_1 at the 3rd ordered value and Q3Q_3 at the 9th, both exact positions with no interpolation needed. For N=10N = 10, Q1Q_1 falls at position 2.75, which means interpolating between the 2nd and 3rd values.

Other conventions exist, and software packages do not all agree. Two defensible methods can give slightly different quartiles for the same small data set, which is why a reported IQR should say which method produced it.

Variable Key

Symbol

Meaning

Unit or type

Notes

IQR\text{IQR}

interquartile range

same units as the data

the quantity being computed

Q1Q_1

first quartile

same units as the data

the 25th percentile

Q3Q_3

third quartile

same units as the data

the 75th percentile

Q2Q_2

median

same units as the data

not used in the formula itself

NN

number of observations

count

sets the quartile positions

Examples of the Interquartile Range Formula

Example 1

Find the interquartile range of 2, 4, 5, 7, 8, 11, 12, 15, 18, 19, 27.

There are N=11N = 11 values, already ordered. Using the 0.25(N+1)0.25(N+1) rule, Q1Q_1 is the 3rd value and Q3Q_3 is the 9th:

Q1=5,Q3=18Q_1 = 5, \qquad Q_3 = 18 IQR=18−5=13\text{IQR} = 18 - 5 = 13

Final answer: IQR=13\text{IQR} = 13

Example 2

Find the interquartile range of 9, 2, 15, 4, 11, 7, 20 without sorting first.

The formula says subtract Q1Q_1 from Q3Q_3, and the data looks ready to use. Taking the quartiles from the positions as given, the 2nd value is 2 and the 6th is 7:

7−2=57 - 2 = 5

That gives 5. But the data set runs from 2 to 20, so a middle-half spread of 5 is implausibly narrow, and the "quartiles" picked out two values that are nowhere near the 25th and 75th percentiles.

Quartiles are positional, so the data must be ordered before any position means anything. Sorted, the set is 2, 4, 7, 9, 11, 15, 20, with N=7N = 7, putting Q1Q_1 at the 2nd value and Q3Q_3 at the 6th:

Q1=4,Q3=15Q_1 = 4, \qquad Q_3 = 15 IQR=15−4=11\text{IQR} = 15 - 4 = 11

Final answer: IQR=11\text{IQR} = 11

Example 3

Find the interquartile range of 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.

With N=10N = 10, Q1Q_1 sits at position 0.25(11)=2.750.25(11) = 2.75, so interpolate 75 per cent of the way from the 2nd value to the 3rd:

Q1=20+0.75(30−20)=27.5Q_1 = 20 + 0.75(30-20) = 27.5

Q3Q_3 sits at position 0.75(11)=8.250.75(11) = 8.25, so interpolate a quarter of the way from the 8th to the 9th:

Q3=80+0.25(90−80)=82.5Q_3 = 80 + 0.25(90-80) = 82.5 IQR=82.5−27.5=55\text{IQR} = 82.5 - 27.5 = 55

Final answer: IQR=55\text{IQR} = 55

Example 4

Two data sets share the same range. Set A is 1, 50, 50, 50, 99 and set B is 1, 25, 50, 75, 99. Compare their interquartile ranges.

Both run from 1 to 99, so both have a range of 98. With N=5N = 5, Q1Q_1 is at position 1.5 and Q3Q_3 at position 4.5, so each is a midpoint of two neighbours.

For A, Q1=1+502=25.5Q_1 = \frac{1+50}{2} = 25.5 and Q3=50+992=74.5Q_3 = \frac{50+99}{2} = 74.5, giving IQR=49\text{IQR} = 49. For B, Q1=1+252=13Q_1 = \frac{1+25}{2} = 13 and Q3=75+992=87Q_3 = \frac{75+99}{2} = 87, giving IQR=74\text{IQR} = 74.

Final answer: IQR=49\text{IQR} = 49 for A and 7474 for B.

Identical ranges, very different central spreads. The range saw only the endpoints, which both sets share.

Example 5

A data set has Q1=32Q_1 = 32 and Q3=48Q_3 = 48. Find the IQR and the NIST inner fences.

IQR=48−32=16\text{IQR} = 48 - 32 = 16

The NIST e-Handbook places inner fences 1.5 times the IQR beyond each quartile:

32−1.5(16)=8,48+1.5(16)=7232 - 1.5(16) = 8, \qquad 48 + 1.5(16) = 72

Final answer: IQR=16\text{IQR} = 16, with inner fences at 8 and 72.

Any value below 8 or above 72 would be flagged as a mild outlier by that rule.

Don't Confuse the IQR With the Range or the Quartile Deviation

Quantity

Formula

What it uses

Interquartile range

Q3−Q1Q_3 - Q_1

the middle 50 per cent

Range

largest minus smallest

only the two extreme values

Quartile deviation

Q3−Q12\frac{Q_3 - Q_1}{2}

half the IQR, also called the semi-interquartile range

Standard deviation

∑(xi−xˉ)2n−1\sqrt{\frac{\sum (x_i - \bar{x})^2}{n-1}}

every value, with squared weighting

The quartile deviation is the one most often mistaken for the IQR, because it is built from the same two numbers. If a question asks for spread "about the median" using quartiles, it usually wants the halved version.

Where Intuition Breaks on the Interquartile Range

Mistake 1: Computing quartiles on unsorted data

Where it slips in: The formula names Q1Q_1 and Q3Q_3 rather than positions, so the ordering step is easy to treat as optional.

Don't do this: Read quartiles off the data in the order it was collected.

The correct way: Sort ascending first, then locate the quartile positions. An IQR that looks too small for the visible spread is the signature of unsorted data.

Students who write the sorted list as a separate line, rather than sorting mentally, rarely lose this step, because the sorted row becomes the thing they read positions from. It also makes the median visible as a free check.

Mistake 2: Treating the IQR as if it used every value

Where it slips in: It is a measure of spread, and most measures of spread respond to every observation.

Don't do this: Expect the IQR to change when an extreme value is made more extreme.

The correct way: Remember that moving the largest value from 100 to 10,000 leaves Q1Q_1 and Q3Q_3 untouched, so the IQR does not move at all. That insensitivity is a feature, not a defect.

Mistake 3: Mixing quartile conventions within one comparison

Where it slips in: One figure comes from a spreadsheet and another from a textbook method, and the two use different quartile definitions.

Don't do this: Compare an IQR computed by one convention against an IQR computed by another.

The correct way: Use a single method throughout and say which one. On small data sets the gap between conventions can be larger than the difference you are trying to measure.

Wrapping Up

  • The interquartile range formula is IQR=Q3−Q1\text{IQR} = Q_3 - Q_1, the spread of the middle half of the data.

  • Quartiles are positional, so the data must be sorted before the formula means anything.

  • The IQR ignores the top and bottom quarters, which is why extreme values cannot shift it.

  • More than one quartile convention exists, so an IQR from a small sample should state the method used.

  • To work through data handling with a teacher, explore a 7th grade math tutor or math tuition.

Your Next Move

Find the IQR of 3, 6, 7, 9, 12, 14, 21, 25. Then change the 25 to 250 and recompute, confirming that the IQR does not move.

Want a live Bhanzu trainer to walk through more statistics problems? Book a free demo class.

Read More

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the interquartile range formula?
IQR=Q3−Q1\text{IQR} = Q_3 - Q_1. Subtract the first quartile from the third quartile.
Why use the interquartile range formula instead of the range?
Because the range is decided entirely by the two most extreme values, so a single unusual observation can dominate it. The IQR discards the top and bottom quarters, so it describes where the bulk of the data actually sits.
Can the interquartile range be zero?
Yes. If at least half the values are identical and that block covers both quartiles, then Q1=Q3Q_1 = Q_3 and the IQR is zero even though the data varies.
How does the interquartile range formula find outliers?
Through fences. The NIST e-Handbook places inner fences at Q1−1.5×IQRQ_1 - 1.5 \times \text{IQR} and Q3+1.5×IQRQ_3 + 1.5 \times \text{IQR}, and outer fences at three times the IQR, with the outlier formula covering the rule in full.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →