Interquartile Range Calculator
Enter six data values to find Q1, Q3, and the interquartile range.
What the interquartile range is
This calculator sorts your six values, finds the first and third quartiles, and subtracts: the result is the interquartile range (IQR), the span covering the middle 50% of the data. At the defaults 4, 7, 2, 9, 5 and 12, the sorted order is 2, 4, 5, 7, 9, 12, giving Q1 = 4, Q3 = 9 and IQR = 5. Because the outer quarters are discarded, a single extreme value cannot inflate the number.
How the quartiles are found
With six values, the method splits the sorted list into a lower half of three and an upper half of three. Q1 is the median of the lower half and Q3 is the median of the upper half. For the defaults, the lower half 2, 4, 5 has median 4 and the upper half 7, 9, 12 has median 9, so IQR = 9 − 4 = 5. The overall median, 6 here, sits between the two halves and plays no part in the subtraction.
Why six values is a clean case
This half-split is the Tukey convention. Software packages disagree slightly on odd-sized sets: some include the median in both halves, others interpolate between positions. With exactly six values the split is clean and every convention agrees, which makes this tool a safe reference for homework checks. For larger data sets, expect Q1 and Q3 to vary by a few tenths between methods, though the IQR itself rarely shifts by more than that.
Worked example with the default inputs
Enter 4, 7, 2, 9, 5, 12 in any order. Sorting gives 2, 4, 5, 7, 9, 12. Lower half: 2, 4, 5, median Q1 = 4. Upper half: 7, 9, 12, median Q3 = 9. Subtract: 9 − 4 = 5. Half the data, the two middle values 5 and 7 plus everything between, lies inside a band 5 units wide.
Compare that with the full range: 12 − 2 = 10, twice the IQR. If the 12 were mis-keyed as 120, the range would explode to 118 while the IQR would stay at 5, because 120 only replaces a value in the discarded outer quarter. That resistance is the whole point of the statistic.
IQR versus other spread measures
| Measure | Defaults result | Resists outliers | Typical use |
|---|---|---|---|
| Range | 10 (12 − 2) | No | Quick bound, not summary |
| IQR | 5 (9 − 4) | Yes | Box plots, outlier fences |
| Standard deviation | About 3.6 | No | Symmetric, bell-shaped data |
For the six defaults, the population standard deviation is about 3.6 and the IQR is 5. On clean, bell-shaped data the IQR is roughly 1.35 standard deviations; here 1.35 × 3.6 ≈ 4.9, close to 5. When that ratio drifts far from 1.35, the data is skewed or contaminated, which makes the IQR-to-sigma comparison a quick distribution check.
Using the IQR to flag outliers
The standard fences sit 1.5 IQRs beyond the quartiles. At the defaults, the lower fence is 4 − 1.5 × 5 = −3.5 and the upper fence is 9 + 1.5 × 5 = 16.5. Any value below −3.5 or above 16.5 is a candidate outlier; the value 20 would be flagged while 16 would not. Extreme outliers use a 3 × IQR fence, which here gives −11 and 24. These same fences are what the whiskers of a box plot extend to.
Common mistakes
- Skipping the sort: quartiles are positional, so reading positions directly from 4, 7, 2, 9, 5, 12 unsorted gives nonsense. The calculator sorts internally, but hand checks must sort first.
- Confusing IQR with range: the range spans all data (10 here), the IQR spans only the middle half (5 here). Reporting 10 as the IQR doubles the spread and loses the outlier protection.
- Using it on tiny or heavily tied data: with three identical values and one outlier, the IQR can be 0 even though the data visibly varies. Six distinct values, as here, is a reasonable minimum.
- Mixing quartile conventions between tools: a spreadsheet QUARTILE.INC on six values returns the same 4 and 9 here, but on five or seven values the answers can differ by 0.25–0.5. Check which convention your source uses before comparing.
What a given IQR tells you
Interpretation depends on units and context. An IQR of 5 on scores running from 2 to 12 means most observations cluster within a 5-unit band, a wide spread for a 10-unit instrument. Delivery times with an IQR of 5 minutes against a median of 30 are consistent and predictable; the same IQR against a median of 6 would mean doubling variability. Always read the IQR next to the median, since the pair (median 6, IQR 5) describes location and spread separately. For a mean-and-sigma view of the same data, the standard deviation calculator is the companion tool.
Where the IQR earns its keep in practice
- Income and home-price statistics, where a few extreme values would wreck a standard deviation: reports quote the middle 50% for exactly this reason.
- Clinical lab reference ranges, where the middle 50% shows whether a patient value sits in the crowded center or the sparse tail.
- Manufacturing tolerance studies, where machine-to-machine spread is compared across shifts without letting one bad part distort the picture.
- Box plots in any 2026 dashboard tool: the box is drawn from Q1 to Q3, so the IQR is literally the box height.
Pairing IQR with the median
The median and IQR describe the same resistant view of the data: the median ignores the outer halves for location, the IQR ignores them for spread. Quote them together, as in median 6, IQR 5 for the defaults, and your summary survives data-entry errors that would sink a mean-plus-standard-deviation report.
Frequently asked questions
What is the IQR of 4, 7, 2, 9, 5 and 12?
Sorted: 2, 4, 5, 7, 9, 12. Q1 is the median of 2, 4, 5, which is 4, and Q3 is the median of 7, 9, 12, which is 9. The IQR is 9 − 4 = 5.
Why use IQR instead of range?
The range spans every value and is destroyed by one extreme: a mis-keyed 120 instead of 12 turns a range of 10 into 118. The IQR discards the outer 25% on each side and would stay at 5.
What is the 1.5 × IQR rule?
Values below Q1 − 1.5×IQR or above Q3 + 1.5×IQR are flagged as potential outliers. At the defaults the fences are −3.5 and 16.5, so 20 is flagged and 16 is not.
Is the IQR ever negative?
No. Sorting guarantees Q3 ≥ Q1, so the IQR is zero or positive. An IQR of 0 means the middle values are tied, not that the data has no spread.
How is Q1 found with six values?
Sort the data, split into a lower half of three and an upper half of three, and take the median of each half. This Tukey method gives Q1 = 4 and Q3 = 9 for the defaults, with no interpolation needed.
What is the relationship between IQR and standard deviation?
On bell-shaped data the IQR is about 1.35 standard deviations. The defaults have a standard deviation near 3.6 and an IQR of 5, and 1.35 × 3.6 ≈ 4.9, so the ratio confirms the data is roughly symmetric.
Does the order I enter the values matter?
No. The calculator sorts the six values before computing, so 4, 7, 2, 9, 5, 12 and 2, 4, 5, 7, 9, 12 both return Q1 = 4, Q3 = 9, IQR = 5.
What do the box plot whiskers mean?
The box edges are Q1 and Q3, so the box height is the IQR of 5 here. Whiskers extend to the most extreme values inside the 1.5 × IQR fences of −3.5 and 16.5, and points beyond are drawn as individual outliers.
Method and sources
- Interquartile range definition IQR = Q3 - Q1.