Quick Answer
IQR = Q3 − Q1, the spread of the middle half of the data. For 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49, the median is 40. Method 1 leaves the median out of each half, so Q1 = 15 and Q3 = 43, and the IQR is 28. Method 2 keeps the median in both halves, which gives Q1 = 25.5, Q3 = 42.5 and an IQR of 17.
Embed this calculator
Adjust the size if needed, then copy the code below into your page or blog. The calculator will load in an iframe and stay updated automatically.
Table of Contents
- IQR Calculator
- Quick Answer
- Related Calculators
- How This IQR Calculator Works
- How to Use the IQR Calculator
- Core Formulas
- Key Terms
- Worked Example
- Real-Life Examples
- IQR vs Standard Deviation
- Quartiles of 1 to 8 by Method
- Which Quartile Method Should I Use?
- A Larger Example From NIST
- Common Mistakes to Avoid
- Frequently Asked Questions
- References & Sources
How This IQR Calculator Works
Paste your numbers, separated by commas, spaces or new lines, and choose a quartile method. The calculator sorts the data, finds the median, the lower quartile (Q1) and the upper quartile (Q3), and subtracts Q1 from Q3 to get the interquartile range (IQR). It also shows the quartile deviation, the range, and the fences used to spot outliers, with every step written out.
Quartiles don’t have one agreed definition. Textbooks, calculators and statistics programs use different rules, and for small data sets they can give different answers. That’s why the second table shows Q1, Q3 and the IQR for all five methods at once. If your answer doesn’t match your book or teacher, look for the row that does, then choose that method.
Quick explanation:
- Q1: about a quarter of the data is below it.
- Median: the middle of the sorted data.
- Q3: about three quarters of the data is below it.
- IQR: Q3 − Q1, the width of the middle half.
How to Use the IQR Calculator
- Paste or type your numbers.
- Choose the quartile method you were taught.
- Press Calculate or Enter.
- Read the IQR, quartiles and fences, and check the steps.
- Compare methods in the second table, then save, share or print.
Core Formulas
- IQR: Q3 − Q1
- Quartile deviation: (Q3 − Q1) ÷ 2
- Inner fences: Q1 − 1.5 × IQR and Q3 + 1.5 × IQR
- Outer fences: Q1 − 3 × IQR and Q3 + 3 × IQR
- Position methods: find the position p(n + 1), 1 + p(n − 1) or p(n + 1/3) + 1/3, with p = 0.25 for Q1 and 0.75 for Q3. Write it as a whole number k plus a fraction d. The quartile is value k plus d times the gap to value k + 1.
Key Terms
- Quartile: a value that splits sorted data into quarters.
- Q1: the lower quartile, or 25th percentile.
- Q3: the upper quartile, or 75th percentile.
- IQR: the interquartile range, Q3 − Q1.
- Fence: a cutoff beyond which a value is called a possible outlier.
- Hinges: Tukey’s name for quartiles found with Method 2.
Worked Example
Find the IQR of 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 with Method 1.
- There are 11 values, already sorted. The median is the 6th value, 40.
- Method 1 leaves the median out. The lower half is 6, 7, 15, 36, 39, so Q1 = 15.
- The upper half is 41, 42, 43, 47, 49, so Q3 = 43.
- IQR = 43 − 15 = 28.
- Inner fences: 15 − 1.5 × 28 = −27 and 43 + 1.5 × 28 = 85. No value is outside them, so there are no outliers.
With Method 2, the median stays in both halves: 6, 7, 15, 36, 39, 40 gives Q1 = 25.5, and 40, 41, 42, 43, 47, 49 gives Q3 = 42.5. The IQR is then 17. Both answers are correct for their method.
Real-Life Examples
- Homework: check quartiles and the IQR, and see the working.
- Box plots: find the box edges and whisker limits.
- Outliers: flag values beyond 1.5 × IQR from the box.
- Skewed data: describe spread when a few large values would inflate the standard deviation.
- Comparing groups: save one data set as A, then compare another.
IQR vs Standard Deviation
- IQR: the spread of the middle 50% of the data. Extreme values barely change it.
- Standard deviation: uses every value, so one very large or small value can change it a lot.
- Which to report: the median with the IQR suits skewed data. The mean with the standard deviation suits roughly symmetric data.
Quartiles of 1 to 8 by Method
Even with eight simple numbers, the methods disagree. This is why answers from different books and programs can differ.
| Method | Q1 | Q3 | IQR |
|---|---|---|---|
| Method 1 (leave the median out) | 2.5 | 6.5 | 4 |
| Method 2 (keep the median in) | 2.5 | 6.5 | 4 |
| p(n + 1), NIST | 2.25 | 6.75 | 4.5 |
| 1 + p(n − 1) | 2.75 | 6.25 | 3.5 |
| p(n + 1/3) + 1/3 | 2.416667 | 6.583333 | 4.166667 |
Which Quartile Method Should I Use?
Use the one your course, exam board or software uses. Here’s what each method does:
- Method 1: split the sorted data at the median. With an odd count, leave the median out of both halves. Q1 and Q3 are the medians of the halves. Many school courses and handheld calculators use this.
- Method 2: the same, but with an odd count the median is kept in both halves. These are called Tukey’s hinges, and some box plot rules use them.
- p(n + 1): the method NIST uses by default. Q1 is at position 0.25(n + 1).
- 1 + p(n − 1): the method many spreadsheet programs use for their standard quartile function.
- p(n + 1/3) + 1/3: the method Hyndman and Fan recommended in their review of nine ways to find quantiles.
NIST notes that the last three methods give fairly similar but not identical results, especially for small samples, and that any of them should be acceptable for most purposes. With hundreds of values, all five methods are usually very close.
A Larger Example From NIST
NIST’s handbook checks a sorted set of 90 values for outliers. With its p(n + 1) method, Q1 is the 22.75th value: 411 + 0.75 × (436 − 411) = 429.75. Q3 is the 68.25th value: 739 + 0.25 × (752 − 739) = 742.25. The IQR is 312.5, so the inner fences are -39 and 1211. One value, 1441, is above the upper inner fence, so it’s a mild outlier. It’s below the upper outer fence of 1679.75, so it isn’t extreme.
Common Mistakes to Avoid
- Forgetting to sort. Quartiles come from the sorted data.
- Mixing methods. Use the same rule for Q1 and Q3.
- Thinking one answer is wrong. Two methods can both be correct.
- Calling every point outside the fences an error. It’s a value to check, not one to delete.
- Using the range instead. The range uses only the two extreme values.
Frequently Asked Questions
The interquartile range: Q3 minus Q1. It’s the spread of the middle half of the data.
Sort the data, find Q1 and Q3, then subtract Q1 from Q3.
There are several quartile methods. Check the table of methods and choose the one that matches.
Many school courses use Method 1, but check your course or textbook.
In Method 1, no. In Method 2, yes, when the count is odd. With an even count, both methods split the data exactly in half.
A value below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR is a possible outlier. NIST calls these mild outliers.
A value more than 3 × IQR below Q1 or above Q3.
Half the IQR. It’s also called the semi-interquartile range.
No. Q3 is never below Q1, so the IQR is zero or more.
At least half the values are the same. Any value different from Q1 or Q3 will then be outside the fences.
At least 4. With very few values, quartiles mean little.
Yes. New lines, commas, spaces and semicolons all work.
Yes. Save each set by name in this browser.
Yes. Use Compare: keep as A.
Yes. Use Share link or Print.
References & Sources
| Source | Used For | Link |
|---|---|---|
| NIST/SEMATECH e-Handbook of Statistical Methods, 7.2.6.2 Percentiles | The p(N + 1) method used by NIST, and the 1 + p(N − 1) and Hyndman and Fan (R8) methods. | https://www.itl.nist.gov/div898/handbook/prc/section2/prc262.htm |
| NIST/SEMATECH e-Handbook of Statistical Methods, 7.1.6 What are outliers in the data? | Inner fences at 1.5 × IQR and outer fences at 3 × IQR, with a worked example. | https://www.itl.nist.gov/div898/handbook/prc/section1/prc16.htm |
| Wikipedia, Quartile | Methods 1 and 2: split the data at the median and leave the median out or keep it in (Tukey’s hinges). | https://en.wikipedia.org/wiki/Quartile |
| Python documentation, statistics | Used to check this calculator’s results: quantiles, correlation and ranked correlation. | https://docs.python.org/3/library/statistics.html |