Interquartile Range Calculator
Calculate interquartile range with instant, accurate results and clear step-by-step output.
About
The interquartile range (IQR) is the difference between the third quartile (Q3, the 75th percentile) and the first quartile (Q1, the 25th percentile): IQR = Q3 - Q1. It measures the spread of the middle 50% of the data and is robust to outliers — unlike the standard deviation, which is sensitive to extreme values. The IQR is the most common robust measure of statistical dispersion, used in box plots, outlier detection, and exploratory data analysis.
The IQR is computed in three steps. First, sort the data in ascending order. Second, find Q1 (the median of the lower half) and Q3 (the median of the upper half). Third, subtract: IQR = Q3 - Q1. The exact method for splitting the data into halves and computing the median of each half varies between software packages — NumPy, R, Excel, and TI calculators all give slightly different answers for small datasets. This calculator supports four common methods: linear interpolation (NumPy default), Tukey (box plots), exclusive (Excel PERCENTILE.EXC), and inclusive (Excel PERCENTILE.INC).
The IQR is used in two main applications. First, in box plots (Tukey, 1977), the box spans Q1 to Q3 (so the box width is the IQR), with the median marked inside and whiskers extending to the most extreme value within 1.5×IQR of Q1 and Q3. Points beyond the whiskers are plotted individually as suspected outliers. Second, in the Tukey outlier rule, any value below Q1 - 1.5×IQR or above Q3 + 1.5×IQR is flagged as a suspected outlier.
The IQR is preferred over standard deviation for skewed or heavy-tailed distributions because it is robust to outliers. Changing the maximum value from 100 to 1,000,000 has no effect on the IQR (because Q1 and Q3 are unaffected by extreme values). For normally-distributed data without outliers, mean ± SD is more efficient — it carries more information per data point. The IQR is also related to the standard deviation by σ ≈ IQR/1.349 for normal data, which is the basis of the robust σ estimator.
The Tukey outlier rule (1.5×IQR fences) is empirical: it flags about 0.7% of normally-distributed data as suspected outliers, so a few false positives are expected in large samples. For \"far out\" outliers, use the 3×IQR fence, which flags only the most extreme 0.002% of normal data. Outlier detection with IQR is robust because it does not assume any particular distribution shape — it works for skewed, multimodal, and heavy-tailed data, not just normal. Always inspect flagged outliers manually to determine if they are genuine anomalies, data entry errors, or natural extremes.
How to Use
- 1Enter your data setType numbers separated by commas or spaces (e.g., "3, 7, 8, 5, 12, 14, 21, 13, 18"). The calculator parses and sorts them automatically. Non-numeric entries are ignored. Sample sizes from 4 to 1000 work well — for very small samples, quartile estimates are noisy.
- 2Pick the quartile methodLinear interpolation (NumPy default, used by most software), Tukey (excludes median in halves, used in box plots), Exclusive (Excel PERCENTILE.EXC), or Inclusive (Excel PERCENTILE.INC). Most users should use Linear; pick Tukey for box-plot consistency.
- 3Review Q1, Q3, and IQRThe hero result shows the IQR. The breakdown shows Q1, Q2 (median), Q3, IQR, min, max, range, and count. These statistics describe the central tendency, spread, and shape of your data distribution.
- 4Examine outliersValues below Q1 - 1.5×IQR or above Q3 + 1.5×IQR are flagged as suspected outliers (Tukey rule). The output shows the lower fence, upper fence, and the list of outliers from your data. Use this for data cleaning and anomaly detection.
- 5Compare to mean and standard deviationFor normal data, σ ≈ IQR/1.349 and μ ≈ median. If these differ substantially, your data is non-normal or has outliers — use IQR/median for robust summaries, or investigate the data quality.
Formula
Computation steps:
1. Sort the data in ascending order.
2. Q1 = 25th percentile (median of lower half).
3. Q3 = 75th percentile (median of upper half).
4. IQR = Q3 - Q1.
Outlier detection (Tukey rule):
Lower fence = Q1 - 1.5 × IQR
Upper fence = Q3 + 1.5 × IQR
Outliers: values < lower fence OR > upper fence
Robust σ estimator (for normal data):
σ ≈ IQR / 1.349
Example: data = [3, 7, 8, 5, 12, 14, 21, 13, 18].
- Sorted: [3, 5, 7, 8, 12, 13, 14, 18, 21]
- Q1 = 6 (median of [3, 5, 7, 8]), Q3 = 16 (median of [13, 14, 18, 21])
- IQR = 16 - 6 = 10
- Fences: -9 and 31; no outliers
Worked Example
Example 1 — Data [1, 2, 3, 4, 100] (with outlier):
- Sorted: [1, 2, 3, 4, 100]
- Q1 = 1.5, Q3 = 4, IQR = 2.5
- Lower fence = 1.5 - 3.75 = -2.25; upper fence = 4 + 3.75 = 7.75
- Outlier: 100 (above upper fence 7.75)
Example 2 — Data [10, 10, 10, 10, 10] (no spread):
- Q1 = 10, Q3 = 10, IQR = 0
- Fences are both 10; no outliers (but no information either)
Example 3 — Data [1-10] (uniform 1 to 10):
- Sorted: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- Q1 = 2.75, Q3 = 8.25, IQR = 5.5 (50% of data range)
- Lower fence = -5.5; upper fence = 16.5; no outliers
Tips
- Memorize the Tukey outlier rule: lower fence = Q1 - 1.5×IQR, upper fence = Q3 + 1.5×IQR. Values outside these fences are suspected outliers.
- For normal data, σ ≈ IQR/1.349. This is the basis of the robust σ estimator — use it when you suspect outliers but want a σ-like dispersion measure.
- Different software uses different quartile methods: NumPy default = linear interpolation; Excel PERCENTILE.INC = inclusive; Excel PERCENTILE.EXC = exclusive; R default = Tukey (type 7 in quantile()). Don't be surprised if Q1/Q3 differ slightly between tools.
- IQR is robust to outliers but loses information for normal data. For normal data without outliers, mean ± SD carries more information per data point.
- Always sort data and visualize with a box plot before computing summary statistics — eyeball the distribution shape, then pick the right summary (mean/SD for normal, median/IQR for skewed).
Common Mistakes
- Forgetting to sort data first — quartiles require ascending order.
- Using different quartile methods across tools — Q1/Q3 can differ by a few percent between NumPy, Excel, R.
- Treating all flagged outliers as errors — the 1.5×IQR rule flags ~0.7% of normal data as outliers by design.
- Using IQR for normal data when SD carries more information — IQR/median is for skewed or outlier-heavy data.
- Forgetting that the IQR ignores the lower 25% and upper 25% of data — for full distribution shape, use a histogram or box plot.
Frequently Asked Questions
- What is the interquartile range (IQR)?
- The interquartile range (IQR) is the difference between the third quartile (Q3, the 75th percentile) and the first quartile (Q1, the 25th percentile): IQR = Q3 - Q1. It measures the spread of the middle 50% of the data and is robust to outliers — unlike the standard deviation, which is sensitive to extreme values. The IQR is the most common robust measure of statistical dispersion, used in box plots, outlier detection, and exploratory data analysis.
- How are Q1 and Q3 calculated?
- First sort the data in ascending order. Q1 is the median of the lower half of the data; Q3 is the median of the upper half. The exact method for splitting the data and computing the median varies: "exclusive" (Tukey, default in box plots) excludes the overall median when splitting; "inclusive" (Excel PERCENTILE.INC) includes it. Linear interpolation (PERCENTILE.INC, NumPy default) gives yet slightly different results. This calculator uses linear interpolation by default; pick another method from the dropdown if needed.
- How does the IQR detect outliers?
- The standard Tukey rule flags any value below Q1 - 1.5×IQR or above Q3 + 1.5×IQR as a suspected outlier. The 1.5×IQR fence is empirical — it flags about 0.7% of normally-distributed data as outliers (so a few false positives are expected in large samples). For "far out" outliers, use the 3×IQR fence, which flags only the most extreme values (about 0.002% of normal data). Outlier detection with IQR is robust because it does not assume any particular distribution shape.
- Why use IQR instead of standard deviation?
- Standard deviation assumes a roughly normal (Gaussian) distribution and is sensitive to outliers — a single extreme value can inflate the SD dramatically. The IQR is robust: changing the maximum value from 100 to 1,000,000 has no effect on the IQR (because Q1 and Q3 are unaffected). For skewed data, multimodal data, or data with outliers, the IQR and median are better summaries than the mean and SD. For normally-distributed data without outliers, mean ± SD is more efficient.
- How is the IQR used in box plots?
- In a Tukey box plot, the box spans Q1 to Q3 (so the box width is the IQR). The line inside the box is the median. The whiskers extend to the most extreme data point within 1.5×IQR of Q1 (lower whisker) and Q3 (upper whisker). Any points beyond the whiskers are plotted individually as suspected outliers. Box plots are the standard graphical way to compare distributions across groups — they show median, spread (IQR), and outliers in a single compact graphic.
- What is the relationship between IQR and standard deviation for normal data?
- For a perfectly normal distribution, IQR ≈ 1.349 × σ (standard deviation). This means the IQR captures the central 50% of the data, which corresponds to the range μ ± 0.6745σ. Equivalently, σ ≈ IQR / 1.349. This is the basis of the "robust σ estimator" — using IQR/1.349 as a robust estimate of standard deviation that is insensitive to outliers. The approximation is exact for normal data and breaks down for skewed or heavy-tailed distributions.
IQR basics
The interquartile range (IQR) is the difference Q3 - Q1, the spread of the middle 50% of the data. It is the most common robust measure of statistical dispersion, used in box plots, outlier detection, and exploratory data analysis. Unlike the standard deviation, the IQR is insensitive to outliers — a single extreme value has no effect on Q1 or Q3, so the IQR is the right tool for skewed or heavy-tailed distributions.
Quartiles (Q1, Q3)
The first quartile Q1 is the 25th percentile (25% of data is below it); the third quartile Q3 is the 75th percentile. The median (Q2) is the 50th percentile. Together with min and max, they form the five-number summary that completely describes a distribution's center, spread, and shape. Multiple methods exist for computing quartiles — they differ only in how they interpolate between data points and split the data into halves.
Outlier detection
The Tukey rule flags any value below Q1 - 1.5×IQR or above Q3 + 1.5×IQR as a suspected outlier. The 1.5×IQR fence is empirical — it flags about 0.7% of normally-distributed data (so expect a few false positives in large samples). For far-out outliers, use the 3×IQR fence, which flags only the most extreme 0.002% of normal data. Outlier detection with IQR is robust because it does not assume any distribution shape.
Why IQR vs standard deviation
Standard deviation assumes a roughly normal distribution and is sensitive to outliers. The IQR is robust: changing the maximum value from 100 to 1,000,000 has no effect on the IQR (because Q1 and Q3 are unaffected). For skewed data, multimodal data, or data with outliers, the IQR and median are better summaries than the mean and SD. For normal data without outliers, mean ± SD is more efficient (more information per data point). Pick the right tool for the data shape.
| Data set | Q1, Q3, IQR | Notes |
|---|---|---|
| 3, 5, 7, 8, 12, 14, 18, 21 | Q1=6, Q3=16, IQR=10 | No outliers |
| 1, 2, 3, 4, 100 | Q1=1.5, Q3=4, IQR=2.5 | Outlier: 100 |
| 10, 10, 10, 10, 10 | Q1=10, Q3=10, IQR=0 | No spread |
| 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | Q1=2.75, Q3=8.25, IQR=5.5 | Uniform 1-10 |
The Tukey rule flags any value below Q1 - 1.5×IQR or above Q3 + 1.5×IQR as a suspected outlier. The 1.5 multiplier is empirical — it flags about 0.7% of normally-distributed data (so a few false positives are expected in large samples). For far-out outliers, use the 3×IQR fence, which flags only the most extreme 0.002% of normal data. The rule is robust because it does not assume any distribution shape — it works for skewed, multimodal, and heavy-tailed data.
Authoritative References
- Wikipedia — Interquartile range— WikipediaComprehensive overview of the IQR: definition, calculation methods, the Tukey outlier rule, and applications in box plots and exploratory data analysis.
- Khan Academy — Statistics— khanacademy.orgKhan Academy's tutorial on the interquartile range, quartiles, and box plots — beginner-friendly introduction with worked examples.
- Wolfram MathWorld — Quartile— wolfram.comWolfram MathWorld's technical reference on quartiles, including the multiple conventions for computing Q1 and Q3 from discrete data.
Try our other free calculators
CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.