Interquartile Range Calculator
Calculate the interquartile range (IQR) of any dataset in one click. You'll get Q1, Q2 (median), Q3, the IQR itself, the five-number summary, outlier fences, a sorted value table, and a full box-and-whisker plot — with a clear step-by-step breakdown.
Enter your data
Result
Step-by-step calculation
Sorted value table
| # | Value | Frequency | Position | Quartile |
|---|
Distribution plot
Box-and-whisker plot
How to use the Interquartile Range Calculator
- Paste or type your numbers into the Dataset box. Any common separator works.
- If some values repeat, enter their counts in the Frequencies field — same order as the dataset.
- Choose how many decimals to display (or use Auto for exact values when possible).
- Press Calculate IQR. You'll instantly see Q1, Q2, Q3, the IQR, the fences, any outliers, and both plots.
Method and formulas
The interquartile range (IQR) measures the spread of the middle 50% of a dataset. It's the difference between the third quartile Q3 (the 75th percentile) and the first quartile Q1 (the 25th percentile):
IQR = Q3 − Q1
How quartiles are calculated
Sort the data from smallest to largest, then locate the median (Q2), and use it to split the dataset into a lower half and an upper half. The median of the lower half is Q1; the median of the upper half is Q3. When the total count is odd and the median is a single central value, that value is excluded from both halves (the classic Tukey method).
Outlier fences
Values lying outside the "inner fences" are considered potential outliers:
- Lower fence = Q1 − 1.5 × IQR
- Upper fence = Q3 + 1.5 × IQR
Five-number summary
The five-number summary consists of Minimum, Q1, Q2 (median), Q3, Maximum. It describes the shape and spread of a dataset without assuming any particular distribution.
Worked example: IQR of 1, 3, 4, 6, 8, 9, 11, 12
- Sort the values: 1, 3, 4, 6, 8, 9, 11, 12 (already sorted).
- Median (Q2): N = 8 (even). Middle pair = 6 and 8 → Q2 = (6 + 8) / 2 = 7.
- Lower half: 1, 3, 4, 6 → Q1 = (3 + 4) / 2 = 3.5.
- Upper half: 8, 9, 11, 12 → Q3 = (9 + 11) / 2 = 10.
- IQR: Q3 − Q1 = 10 − 3.5 = 6.5.
- Fences: lower = 3.5 − 1.5×6.5 = −6.25; upper = 10 + 1.5×6.5 = 19.75 → no outliers.
So for 1, 3, 4, 6, 8, 9, 11, 12, Q1 = 3.5, Q2 = 7, Q3 = 10, IQR = 6.5.
How to interpret the result
- Small IQR — the middle 50% of values is tightly grouped; the data is more consistent.
- Large IQR — the middle 50% is widely spread; the data is more variable.
- IQR = 0 — at least half of the values are identical.
- Outliers flagged — values outside the fences deserve scrutiny but are not automatically wrong.
- Compare with mean — IQR is robust to outliers, whereas the mean and standard deviation are not.
Assumptions and limitations
- Quartiles use the "median of halves" (Tukey) method — the same method used by most textbooks and tools such as R's
quantile(type=7)for continuous data. Some software (e.g. Excel'sQUARTILE.EXC) uses slightly different interpolation and may give marginally different values for small datasets. - Frequency entries must be non-negative and match the number of values in the dataset.
- With frequencies, quartiles are computed on the weighted (expanded) dataset — the position index uses the total weighted count.
- Floating-point comparisons use a small tolerance; extremely long decimal values may occasionally be grouped together.
- Outlier fences use the standard 1.5 × IQR rule; a "far out" multiplier of 3 × IQR is not applied automatically.