Quartile and IQR Calculator
Quartiles split sorted data into four equal parts, and the interquartile range (IQR = Q3 − Q1) measures the spread of the middle 50%. For 2, 4, 4, 5, 7, 8, 9, 10, 12, 40, Q1 = 4, the median = 7.5, Q3 = 10 and IQR = 6.
Last updated · By S. Dilshan · Runs in your browser, nothing is uploaded
Advanced options
Step-by-Step Solution
What Are Quartiles and the IQR?
Quartiles divide a sorted dataset into four parts, each holding about a quarter of the values. The first quartile (Q1) is the 25th percentile, the second quartile (Q2) is the median, and the third quartile (Q3) is the 75th percentile. The interquartile range is the distance from Q1 to Q3, so it covers the middle half of the data.
Because the IQR ignores the lowest and highest quarter, it is not distorted by extreme values. That makes it the standard measure of spread to pair with the median, and the basis of the box plot and of the 1.5 × IQR rule for spotting outliers.
Quartiles at a Glance
| Name | Also called | Meaning |
|---|---|---|
| Q1 | 25th percentile, lower quartile | 25% of values are at or below it |
| Q2 | Median, 50th percentile | 50% of values are at or below it |
| Q3 | 75th percentile, upper quartile | 75% of values are at or below it |
| IQR | Q3 − Q1 | Spread of the middle 50% |
Quartile and IQR Formulas
- Q1 is the median of the lower half of the data, and Q3 is the median of the upper half.
- Any value below the lower fence or above the upper fence is flagged as a potential outlier.
Three Ways to Find Q1 and Q3
Different textbooks and programs split the data differently, so your calculator lets you choose:
| Method | How it works | Q1 / Q3 for the example data |
|---|---|---|
| Median of halves, exclude the median | Split at the median. With an odd count, leave the median out of both halves. This is the common textbook method. | 4 / 10 |
| Median of halves, include the median | With an odd count, keep the median in both halves. | 4 / 10 (same here, because n is even) |
| Linear interpolation (Excel QUARTILE.INC) | Uses position (n − 1) × p + 1 and interpolates between values. | 4.25 / 9.75 |
Worked Example: Quartiles, IQR and Outliers
The preloaded data is 2, 4, 4, 5, 7, 8, 9, 10, 12, 40, with n = 10.
- Median (Q2): the 5th and 6th values are 7 and 8, so Q2 = 7.5.
- Lower half: 2, 4, 4, 5, 7. Its middle value gives Q1 = 4.
- Upper half: 8, 9, 10, 12, 40. Its middle value gives Q3 = 10.
- IQR: 10 − 4 = 6.
- Fences: 4 − 1.5 × 6 = −5 and 10 + 1.5 × 6 = 19.
- Outliers: 40 is above 19, so it is flagged. Nothing is below −5.
The Same Data with the Excel Method
With linear interpolation, Q1 = 4.25 and Q3 = 9.75, so the IQR is 5.5 and the fences become −4 and 18. The conclusion is the same, since 40 is still an outlier, but the numbers differ slightly. That is why you should always state the method with your results.
How to Use This Quartile and IQR Calculator
- Paste your numbers into the data box.
- Choose a quartile method. Use the textbook method for homework and Excel’s method to match a spreadsheet.
- Read Q1, the median, Q3, the IQR, the fences and any outliers.
- Open the steps to see the halves and how each quartile was found.
For the full minimum-to-maximum picture, use the five-number summary calculator, or check individual values with the outlier calculator.
Real-World Uses of Quartiles and the IQR
- Box plots: the box is Q1 to Q3, the line inside is the median, and the whiskers reach to the fences.
- Data cleaning: the 1.5 × IQR rule is a quick, assumption-light way to flag suspicious values.
- Salary and pricing analysis: “the middle 50% of offers fall between X and Y” is an IQR statement.
- Exam reporting: teachers describe class results by quartile to show how many students fell in each band.
- Skewed data: the median and IQR are the right summary pair when the mean and standard deviation are unreliable.
Reading a Box Plot
The box spans Q1 to Q3, so its length is the IQR. The line inside is the median. If it sits off-centre, the data is skewed. Whiskers extend to the most extreme values still inside the fences, and any dots beyond them are the flagged outliers.
What Are the Most Common Mistakes With the Quartile and IQR Calculator?
- Not sorting first. Quartiles only make sense on ordered data.
- Mixing methods. Comparing your answer with a textbook or spreadsheet that uses another method can look like an error when it is not.
- Treating flagged outliers as errors. The fences identify unusual values. Whether to remove them is a judgement about your data.
- Applying the 1.5 rule to tiny datasets. With very few values the quartiles themselves are unstable.
- Forgetting multimodal data. The IQR says nothing about shape, so two clusters can hide behind a single number.
Where Can You Verify These Formulas?
The definitions and formulas on this page follow standard references. Check them against these sources:
Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.
Frequently Asked Questions
What is the interquartile range?
The IQR is the difference between the third quartile and the first quartile (Q3 − Q1). It measures the spread of the middle 50% of the data and is not affected by extreme values.
How do you find Q1 and Q3?
Sort the data, find the median, then take the median of the lower half for Q1 and the median of the upper half for Q3. Spreadsheet programs may use interpolation instead.
How do you find outliers using the IQR?
Calculate Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. Any value outside those fences is a potential outlier. In the example the upper fence is 19, so 40 is flagged.
Why do I get different quartiles in Excel?
Excel’s QUARTILE.INC uses linear interpolation, while many textbooks use the median-of-halves method. Choose the method in the calculator that matches your source.
Is the IQR better than the standard deviation?
It is more resistant to outliers and works well with skewed data. The standard deviation uses every value and suits roughly symmetric data. Choose the one that fits your distribution.
Can the IQR be zero?
Yes. If at least half of the values are identical in the middle of the data, Q1 and Q3 can be equal, giving an IQR of zero.