Interquartile Range Calculator

Interquartile Range Calculator

Paste your data to get the interquartile range (IQR), the spread of the middle half of the values, together with the quartiles, the 1.5 × IQR outlier fences and any values that fall outside them.

IQR = Q3 − Q1 · Fences = Q1 − 1.5 × IQR and Q3 + 1.5 × IQR

Separate with commas, spaces or new lines. They don't need to be sorted.

Quartile method

Most textbooks and TI-83/84 calculators: Q1 and Q3 are the medians of the lower and upper halves, leaving out the middle value when n is odd.

Enter at least four numbers to find the IQR

What is the Interquartile Range?

The interquartile range is the distance between the first quartile (Q1) and the third quartile (Q3). A quarter of the data lies below Q1 and a quarter above Q3, so the IQR is the width of the middle half.

Because it ignores the lowest and highest quarters, a few extreme values can't inflate it. That makes the IQR the usual partner for the median when describing skewed data such as incomes or response times, and it's the length of the box in a box plot.

It also gives the most widely used rule for flagging outliers, introduced by the statistician John Tukey: anything more than 1.5 × IQR below Q1 or above Q3 deserves a second look.

How to Calculate the IQR

Fences as defined by Tukey; quartile methods as catalogued by Hyndman and Fan. See Sources.

1. Find the quartiles

Sort the data and find the median. With the textbook method, Q1 is the median of the lower half and Q3 the median of the upper half, leaving the middle value out of both halves when the count is odd.

2. Subtract

IQR = Q3 − Q1

3. Set the outlier fences

Lower fence = Q1 − 1.5 × IQR
Upper fence = Q3 + 1.5 × IQR

Values outside the fences are possible outliers. For bell-shaped data, the IQR is about 1.35 standard deviations, so IQR ÷ 1.35 gives a rough standard deviation that outliers can't inflate.

Worked Example: Eleven Exam Marks

Given:
Marks, already sorted: 7, 15, 36, 39, 40, 41, 42, 43, 47, 49, 55.
Step 1:
Median and halves:
Median = 6th value = 41
Lower half 7, 15, 36, 39, 40 → Q1 = 36
Upper half 42, 43, 47, 49, 55 → Q3 = 47
Step 2:
IQR:
47 − 36 = 11
Step 3:
Fences:
36 − 1.5 × 11 = 19.5 · 47 + 1.5 × 11 = 63.5
Result:
IQR 11, with 7 and 15 flagged as outliers.

Both are below the lower fence. The range (55 − 7 = 48) is more than four times the IQR because of them.

IQR vs Range When an Outlier Appears

The exam marks with the top mark replaced by more and more extreme values. The range follows the outlier; the IQR stays put.

Range and IQR as the top mark becomes extreme
Top markRangeIQR
554811
706311
1009311
50049311

Common IQR Mistakes

  • Using a different quartile method from your course. For small datasets, textbooks, Excel and calculators can disagree. With the marks above, Excel's QUARTILE.INC gives an IQR of 7.5, not 11. Pick the method that matches.
  • Writing the IQR as an interval. The IQR is a single number, Q3 − Q1. "36 to 47" describes the quartiles; the IQR is 11.
  • Deleting every value outside the fences. A value beyond a fence is a flag, not proof of an error. Check whether it's a typo or a genuine extreme before removing it.
  • Forgetting to sort. Quartiles are positions in sorted data. The calculator sorts for you, but working by hand you must sort first.

Interquartile Range FAQs

Why 1.5 × IQR for outliers?

It’s Tukey’s convention. For bell-shaped data, the 1.5 × IQR fences sit about 2.7 standard deviations from the mean, so only around 0.7% of values fall outside by chance.

Why does Excel give a different IQR?

Excel’s QUARTILE.INC interpolates between values; most textbooks take the medians of the two halves. Choose “Inclusive” above to match Excel, or “Exclusive” for QUARTILE.EXC.

What is the semi-interquartile range?

Half the IQR, also called the quartile deviation. It’s sometimes used as a robust counterpart to the standard deviation.

Can the IQR be zero?

Yes, if half or more of the values are identical so Q1 equals Q3. The fences then collapse onto the quartiles and almost any different value is flagged, so treat that result with care.

IQR or standard deviation?

Use the IQR (with the median) for skewed data or data with outliers, and the standard deviation (with the mean) for roughly symmetric data.

How do I find the IQR in Excel?

=QUARTILE.INC(range,3) − QUARTILE.INC(range,1). Use QUARTILE.EXC instead if your course follows the exclusive method.

How many values do I need?

At least four for the quartiles to mean anything; ideally a few dozen. With very small samples the quartiles depend heavily on the method chosen.

What are extreme outliers?

Values more than 3 × IQR beyond the quartiles (the outer fences). The upper and lower fence calculator separates mild from extreme outliers.

Sources

Related Tools