Interquartile Range (IQR) Calculator

The Interquartile Range (IQR) is a measure of statistical dispersion that represents the range of the middle 50% of your data. Unlike standard deviation, IQR is robust to outliers, making it an excellent choice when your data may contain extreme values.

What is IQR?

The Interquartile Range is the difference between the third quartile (Q3) and the first quartile (Q1). It tells you how spread out the middle half of your data is, ignoring the lowest 25% and highest 25% of values.

Formula

IQR = Q3 - Q1

Where Q1 is the 25th percentile and Q3 is the 75th percentile

Calculation Steps

  1. Sort your data from lowest to highest
  2. Find Q1 (25th percentile) — the value below which 25% of data falls
  3. Find Q2/Median (50th percentile) — the middle value
  4. Find Q3 (75th percentile) — the value below which 75% of data falls
  5. Calculate IQR = Q3 - Q1

Outlier Detection

IQR is commonly used to identify outliers using the "1.5 × IQR rule":

Lower Fence = Q1 - 1.5 × IQR

Upper Fence = Q3 + 1.5 × IQR

Any data point below the lower fence or above the upper fence is considered an outlier.

Five-Number Summary

The five-number summary provides a concise description of your dataset's distribution:

  • Minimum: The smallest value
  • Q1: First quartile (25th percentile)
  • Median (Q2): Middle value (50th percentile)
  • Q3: Third quartile (75th percentile)
  • Maximum: The largest value

These five values are the foundation of a box plot (box-and-whisker plot).

When to Use IQR

  • Skewed distributions: When your data is not normally distributed, IQR gives a better sense of spread than standard deviation
  • Data with outliers: IQR is not affected by extreme values, making it more robust than range or standard deviation
  • Outlier detection: Use IQR to systematically identify outliers in your dataset
  • Box plots: IQR defines the box in a box-and-whisker plot
  • Comparing groups: Compare the spread of different groups without being influenced by extreme values

Example

Consider these test scores: 65, 72, 78, 82, 85, 88, 90, 94, 96, 100

  • Q1 (25th percentile) = 77
  • Median (Q2) = 86.5
  • Q3 (75th percentile) = 95
  • IQR = 95 - 77 = 18
  • Lower Fence = 77 - 1.5 × 18 = 50
  • Upper Fence = 95 + 1.5 × 18 = 122
  • No outliers (all values between 50 and 122)

Percentile Methods

This calculator supports two common methods for calculating percentiles:

  • Inclusive (default): Matches Excel PERCENTILE.INC and R type 7. Uses linear interpolation between points. Best for most applications.
  • Exclusive: Matches Excel PERCENTILE.EXC and R type 6. Excludes the minimum and maximum from the interpolation range. More conservative for outlier detection.