TSE.
MathematicsFinanceHealthPhysicsEngineeringBrowse all

Mathematics · Statistics · Descriptive Statistics

Interquartile Range Calculator

Calculate the interquartile range (IQR), Q1, Q3, and detect outliers from any dataset.

Calculator

Advertisement

Formula

Q1 is the first quartile (25th percentile), Q3 is the third quartile (75th percentile), and IQR is the spread of the middle 50% of data. Outlier fences: \text{Lower} = Q_1 - 1.5 \times \text{IQR}, \quad \text{Upper} = Q_3 + 1.5 \times \text{IQR}.

Source: Tukey, J.W. (1977). Exploratory Data Analysis. Addison-Wesley.

How it works

The dataset is first sorted in ascending order. Q1 is the value at the 25th percentile and Q3 is the value at the 75th percentile, both calculated using linear interpolation between adjacent data points. The IQR is then Q3 minus Q1.

Outlier fences are computed using Tukey's rule: the lower fence is Q1 minus 1.5 times the IQR, and the upper fence is Q3 plus 1.5 times the IQR. Any data point outside these fences is considered a potential outlier.

Worked example

Dataset: 4, 7, 13, 2, 1, 9, 15, 6

Step 1 — Sort: 1, 2, 4, 6, 7, 9, 13, 15 (n = 8)

Step 2 — Q1 position: (8 − 1) × 0.25 = 1.75 → Q1 = 2 + 0.75 × (4 − 2) = 3.5

Step 3 — Q3 position: (8 − 1) × 0.75 = 5.25 → Q3 = 9 + 0.25 × (13 − 9) = 10

Step 4 — IQR = 10 − 3.5 = 6.5

Step 5 — Fences: Lower = 3.5 − 1.5 × 6.5 = −6.25; Upper = 10 + 1.5 × 6.5 = 19.75. No outliers detected in this dataset.

Limitations & notes

The IQR describes spread but not shape — two datasets can have the same IQR with very different distributions. The 1.5 × IQR outlier rule is a guideline, not a definitive statistical test, and may flag too many or too few points in non-normal distributions. For very small datasets (fewer than 4 values), quartile estimates become unreliable.

Frequently asked questions

What does the IQR tell you?

The IQR tells you how spread out the middle 50% of your data is, ignoring the extreme low and high values. A larger IQR means more variability in the central portion of the data.

How is IQR different from standard deviation?

Standard deviation uses all data points and is sensitive to outliers, while IQR only considers the middle 50% and is robust to extreme values. IQR is preferred for skewed distributions.

What method is used to calculate Q1 and Q3?

This calculator uses the inclusive linear interpolation method (Method 2), computing quartiles at positions (n−1) × 0.25 and (n−1) × 0.75 in the sorted array. Different software may use slightly different methods.

How do I identify outliers using the IQR?

Any value below Q1 − 1.5 × IQR (lower fence) or above Q3 + 1.5 × IQR (upper fence) is considered a potential outlier by Tukey's rule. These are the same fences shown in a standard box-and-whisker plot.

Can I use the IQR for any type of data?

The IQR works for any ordinal or continuous numerical data and is especially useful for skewed or non-normal datasets. It is not meaningful for purely categorical data.

Last updated: 2025-01-15 · Formula verified against primary sources.