calculate interquartile range

Interquartile Range Calculator

Enter at least 4 numbers separated by commas, spaces, or new lines.

What is the interquartile range (IQR)?

The interquartile range, often written as IQR, is a measure of spread in a dataset. It tells you how wide the middle 50% of your data is. Instead of focusing on extreme minimum and maximum values, IQR focuses on the central portion, making it useful when your data has outliers.

Formula: IQR = Q3 − Q1
Q1 = first quartile (25th percentile)
Q3 = third quartile (75th percentile)

How to calculate interquartile range step by step

1) Sort the data from smallest to largest

Quartiles are position-based, so sorting is required before anything else.

2) Find the median (Q2)

The median is the middle value. If there are two middle values, average them.

3) Split the data into lower and upper halves

For odd-sized datasets, methods vary:

  • Exclusive median: do not include the median in either half.
  • Inclusive median: include the median in both halves.

This calculator lets you choose either method so your result matches your class or software convention.

4) Find Q1 and Q3

Q1 is the median of the lower half, and Q3 is the median of the upper half.

5) Subtract Q1 from Q3

The final step is simple: IQR = Q3 − Q1.

Worked example

Suppose your sorted data is: 3, 5, 7, 8, 11, 12, 13, 16, 18

  • Median (Q2) = 11
  • Lower half (exclusive) = 3, 5, 7, 8 → Q1 = (5 + 7)/2 = 6
  • Upper half (exclusive) = 12, 13, 16, 18 → Q3 = (13 + 16)/2 = 14.5
  • IQR = 14.5 − 6 = 8.5

Why IQR is useful

  • It is resistant to outliers compared with full range.
  • It summarizes spread in a robust way for skewed data.
  • It is central to box plots and exploratory data analysis.
  • It helps identify potential outliers with the 1.5 × IQR rule.

Outlier detection with IQR

A common rule flags values outside these “fences”:

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

Values below the lower fence or above the upper fence are potential outliers. The calculator above includes these fences automatically.

Common mistakes when calculating IQR

  • Not sorting the data first.
  • Mixing quartile methods (inclusive vs. exclusive) without realizing it.
  • Confusing IQR with range (max − min).
  • Using too few data points to make meaningful spread conclusions.

Quick FAQ

Can IQR be zero?

Yes. If Q1 and Q3 are equal, then IQR is 0, meaning the middle 50% of values are the same.

Is IQR affected by extreme values?

Much less than range or standard deviation. That is why IQR is popular for skewed data.

What if my numbers are decimals or negative?

No problem. The calculator supports decimals and negative values.

Final thoughts

If you want a reliable way to measure variability without letting outliers dominate, calculate interquartile range. It is fast, interpretable, and especially useful for box plots, summary reporting, and robust statistics.

🔗 Related Calculators