What Is the Interquartile Range (IQR)?
The Interquartile Range (IQR) measures statistical dispersion by capturing the exact span of the central 50% of an ordered dataset. While total range subtracts the single smallest value from the single largest value and standard deviation squares every distance from the arithmetic mean, IQR locks strictly onto the middle half of observations between the 25th percentile (Q₁) and the 75th percentile (Q₃).
Because the lowest 25% and highest 25% of observations sit outside the IQR window, extreme typing errors, million-dollar outlier salaries, or rare network latency spikes cannot warp the result. This makes IQR the gold-standard spread metric to pair with the median whenever data is skewed, bounded, or noisy. Our calculator computes textbook Exclusive (TI-84 / OpenStax) IQR, Semi-IQR, Tukey 1.5× and 3.0× outlier fences, outlier-trimmed means, and side-by-side Excel QUARTILE.INC / QUARTILE.EXC comparisons.
Interquartile Range Formulas & Companion Metrics
Start by ordering your N data values from smallest to largest (x₍₁₎ ≤ x₍₂₎ ≤ … ≤ x₍ₙ₎). Once sorted, compute Q₁ (median of the lower half) and Q₃ (median of the upper half) and apply these equations:
Semi-Interquartile Range: Semi-IQR = (Q₃ − Q₁) ÷ 2
Tukey Inner Fences (Mild): Lower = Q₁ − 1.5 × IQR | Upper = Q₃ + 1.5 × IQR
Tukey Outer Fences (Extreme): Lower = Q₁ − 3.0 × IQR | Upper = Q₃ + 3.0 × IQR
Estimated Normal SD: Est. σ ≈ IQR ÷ 1.34898
Quartile Coeff. Dispersion: QCD = (Q₃ − Q₁) ÷ (Q₃ + Q₁)
How to Calculate IQR Without Errors
Every reliable IQR workflow follows four crisp stages, whether you are grading biology lab measurements or diagnosing backend SLA latency spikes:
- Sort Ascending From Min to Max: Rank every observation cleanly from lowest to highest, keeping repeated duplicate numbers in place.
- Locate the Overall Median (
Q₂): On oddN, pick the exact middle rank(N + 1) ÷ 2. On evenN, average the two center items. - Split Into Lower & Upper Halves (Exclusive Rule): Under the standard textbook / TI-84 rule, omit a single odd center
Q₂before taking the median of the lower⌊N/2⌋values (Q₁) and the median of the upper⌊N/2⌋values (Q₃). On evenN, split cleanly down the middle with zero overlap. - Subtract
Q₃ − Q₁: The resulting difference is your Interquartile Range, expressed in the original data units (dollars, milliseconds, test points, or kilograms). Divide by2for Semi-IQR.
2 Worked Examples
Example 1: API Response Latency With a Tail Spike (IQR vs. Full Range)
Suppose an engineering team records 10 server response times (in milliseconds): 44, 18, 29, 72, 22, 35, 12, 38, 25, 31. Calculate IQR, Semi-IQR, QCD, and compare IQR against the full range.
- Sort ascending (N = 10):
12, 18, 22, 25, 29, 31, 35, 38, 44, 72. - Find Median (
Q₂): SinceN = 10is even, average the 5th value (29) and 6th value (31):Q₂ = (29 + 31) ÷ 2 = 30 ms. - Split halves cleanly (5 points each): Lower half is
[12, 18, 22, 25, 29]so the middle value is Q₁ = 22 ms. Upper half is[31, 35, 38, 44, 72]so the middle value is Q₃ = 38 ms. - Calculate IQR and companion metrics:
IQR = 38 − 22 = 16 ms. Meanwhile,Full Range = 72 − 12 = 60 ms, meaning the middle 50% covers just26.7%of the total span (16 ÷ 60).Semi-IQR = 8 ms, andQCD = 16 ÷ (38 + 22) = 0.2667. - Check outliers: Upper inner fence is
38 + 1.5(16) = 62 ms. Thus the72 mslatency spike is flagged as a Mild Outlier while core performance holds tight within a16 msband.
Example 2: Detecting Mild & Extreme Outliers ([14, 19, 20, 22, 24, 25, 27, 29, 48, 86])
Evaluate whether a 10-day batch of defective-part cycle times (14, 19, 20, 22, 24, 25, 27, 29, 48, 86) contains mild or extreme Tukey outliers, and inspect how removing them stabilizes the arithmetic mean.
- Quartiling the lower & upper 5 items: Lower half
[14, 19, 20, 22, 24]gives Q₁ = 20; upper half[25, 27, 29, 48, 86]gives Q₃ = 29; overall medianQ₂ = (24 + 25) ÷ 2 = 24.5. - Compute IQR:
IQR = 29 − 20 = 9. - Compute Tukey Inner Fences (
1.5 × IQR = 13.5): Lower Inner Fence =20 − 13.5 = 6.5; Upper Inner Fence =29 + 13.5 = 42.5. - Compute Tukey Outer Fences (
3.0 × IQR = 27.0): Lower Outer Fence =20 − 27 = −7.0; Upper Outer Fence =29 + 27 = 56.0. - Classify anomalies: Observation
48sits between42.5and56.0(Mild Outlier). Observation86exceeds56.0(Extreme Outlier). The Box Plot upper whisker pulls back strictly to29(the largest inlier inside42.5), and trimming[48, 86]drops the average cycle time from31.4down to22.5.
Why IQR Beats Standard Deviation on Skewed & Noisy Data
In introductory textbooks, students learn two main ways to quantify spread: variance / Standard Deviation (parametric) and IQR (non-parametric). While both measure spread in the same physical units as the original data, they behave dramatically differently whenever a dataset loses bell-curve symmetry or contains measurement spikes.
Statisticians measure robustness using a tool called the breakdown point: the smallest fraction of corrupted observations capable of sending an estimator to infinity. Mean and Standard Deviation have a 0% breakdown point because modifying even a single data point (such as typing 8600 instead of 86) explodes the squared residuals (xᵢ − x̄)². By contrast, IQR enjoys a 25% breakdown point on each tail: up to a quarter of values at the low end and a quarter at the high end can spike wildly without breaking Q₁ or Q₃.
| Property / Question | Interquartile Range (IQR) | Standard Deviation (SD / s) |
|---|---|---|
| Underlying Formula | Q₃ − Q₁ | √[ Σ(xᵢ − x̄)² ÷ (n − 1) ] |
| Best Center Pairing | Median (Q₂) |
Arithmetic Mean (x̄) |
| Sensitivity to Extreme Outliers | Very Low (25% tail breakdown resistance) | High (squared errors amplify tail spikes) |
| Relationship on Bell Curves | IQR ≈ 1.34898 × σ | σ ≈ IQR ÷ 1.34898 |
| Ideal Use Cases | Salaries, housing prices, latency, hospital stays | Manufacturing tolerances, lab heights, normal errors |
Exclusive vs. Inclusive IQR in Excel, Python & R
Why can two statistics apps occasionally report slightly different IQR numbers for the same list of values? On even datasets whose half-lengths are odd (like N = 10 above), or on odd datasets like N = 11, software packages choose between two interpolation conventions when finding Q₁ and Q₃:
- Exclusive Split-Half Method (TI-84, OpenStax, AP Stats): Matches
QUARTILE.EXCcleanly on standard odd ranks (N = 4k + 3orN = 10). It omits the overall median whenNis odd before taking lower and upper half medians. - Inclusive Linear Method (Excel
QUARTILE.INC, Google SheetsQUARTILE, NumPy & R Default): Interpolates alongpos = 1 + p × (N − 1)forp = 0.25andp = 0.75. Including endpoints slightly pullsQ₁andQ₃inward toward the center on oddN.
Excel / Sheets Inclusive IQR: =QUARTILE.INC(A2:A11, 3) - QUARTILE.INC(A2:A11, 1)
Python (SciPy / NumPy): scipy.stats.iqr(data) | np.subtract(*np.percentile(data, [75, 25]))
R Language: IQR(x) (defaults to Inclusive Type 7)
Switch to Mode 3 (Compare IQR Methods) inside the tool above to print both Exclusive and Inclusive IQR side by side automatically, along with the exact difference between them! For deep dives into quartile boundaries themselves, open our dedicated Quartile Calculator.
Interpreting Advanced IQR Companion Ratios
Beyond standalone Q₃ − Q₁, Mode 1 (IQR & Middle 50%) outputs four derived dispersion diagnostics used frequently in research papers and quality-control dashboards:
- Semi-Interquartile Range (
IQR ÷ 2): Half the IQR width. Historically called the probable error in physics and geodesy because under an ideal normal curve, roughly half of all random errors lie withinMedian ± Semi-IQR(±0.6745σ). - Quartile Coefficient of Dispersion (
QCD = IQR ÷ (Q₃ + Q₁)): A unitless relative spread metric analogous to Coefficient of Variation (CV), letting you compare variability cleanly across datasets with different scales (such as dollars vs. response times, assuming positive numbers). - IQR-to-Range Ratio (
IQR ÷ Range): Shows what percentage of total data span holds the middle 50%. A tiny ratio (such as15%) immediately signals heavy outlier tails stretching the outer range far beyond core behavior. - IQR-Based Normal SD Estimate (
IQR ÷ 1.34898): Gives a robust non-parametric estimate of Standard Deviation when data is mostly bell-shaped but tainted by 1 or 2 suspected sensor glitches.
5 Common IQR Mistakes to Avoid
- Computing IQR Before Sorting: Taking the 25th and 75th positions from an unsorted list yields meaningless numbers. Always sort ascending first.
- Reporting IQR as an Interval Rather Than a Single Number: While people informally describe the middle half as spanning "[22 to 38]", the mathematical Interquartile Range (IQR) itself is a single scalar width (
38 − 22 = 16), not a pair of endpoints. - Expecting Zero Outliers Whenever IQR Is Small: In fact, a tight, small IQR shrinks the
1.5 × IQRfences, making moderate tail points more likely to be flagged as outliers than in high-variance datasets! - Forgetting the Inclusive Center Rule on Even vs. Odd Samples: Never include the single middle rank
Q₂in both halves when applying the Exclusive split-half rule on oddN. - Using IQR on Binary or Heavily Tied Categories: If more than 50% of values equal the exact same number (e.g.,
0, 0, 0, 0, 0, 0, 1, 2), thenQ₁ = Q₃ = 0andIQR = 0, telling you nothing about the upper tail.
Related Statistics & Math Calculators
Combine IQR with full descriptive, central-tendency, and normal-curve diagnostics in our Math & Statistics hub:
- Quartile Calculator: full Five-Number Summary, Q1/Q2/Q3 cutoffs, Midhinge, and Exclusive vs. Inclusive tables.
- Median Calculator: quick center ranking with Box-and-Whisker plot inspection.
- Mean, Median & Mode Calculator: compare all three centers alongside IQR and Sample SD.
- Standard Deviation Calculator & Z-Score Calculator: parametric dispersion and normal curve p-values.
All Staticnexa formulas and edge-case rules are documented transparently in our Editorial & Mathematical Accuracy Policy.
Frequently Asked Questions
What is the formula for Interquartile Range (IQR)?
IQR equals Q3 minus Q1 (Upper Quartile minus Lower Quartile). It measures the spread of the middle 50% of sorted data values.
Why is IQR better than full Range?
Full Range (Max minus Min) depends entirely on the two most extreme points, so one typo or spike warps it. IQR ignores the bottom 25% and top 25% of observations, staying stable against outliers.
How does IQR detect outliers using Tukey fences?
Multiply IQR by 1.5 for inner fences [Q1 - 1.5*IQR, Q3 + 1.5*IQR] (Mild Outliers) and by 3.0 for outer fences [Q1 - 3.0*IQR, Q3 + 3.0*IQR] (Extreme Outliers). Values outside those limits are flagged as outliers.
How are IQR and Standard Deviation related?
For a symmetric normal distribution, IQR equals approximately 1.34898 times the Standard Deviation (and Semi-IQR equals 0.6745 * SD). On skewed data, IQR stays much more reliable than SD.
What is the Semi-Interquartile Range?
Semi-IQR equals IQR divided by 2 (half the distance between Q1 and Q3). It acts as a robust measure of spread around the median.
Why do Excel QUARTILE.INC and TI-84 give different IQRs on small samples?
TI-84 calculators and textbooks use Exclusive split-half quartiles, while Excel QUARTILE.INC and NumPy default to Inclusive p*(N - 1) linear interpolation. Both methods converge as sample size increases.
Mathematical References & Standards
- Wikipedia: Interquartile Range (IQR): Definition, Examples & Outliers (Mathematical properties, Semi-IQR, QCD, and relation to normal Standard Deviation (1.34898 * sigma))
- OpenStax Introductory Statistics (2e): Section 2.3: Measures of the Location of the Data (Standard college textbook method for Q1, Q3, IQR, and Tukey 1.5*IQR fences)
- Khan Academy: Interquartile Range (IQR) Review (Worked odd and even examples demonstrating middle-50% spread calculation)
- Khan Academy: Identifying Outliers With the 1.5×IQR Rule (Explanation of Tukey inner fences and whisker truncation around outliers)
- NIST Engineering Statistics Handbook: Section 1.3.5.16: Box Plots & Measures of Scale (IQR / Midspread) (Federal statistical reference on robust spread estimation and outlier fences)