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:

Interquartile Range (IQR): IQR = Q₃ − Q₁
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₁)
Interquartile range diagram on [12, 18, 22, 25, 29, 31, 35, 38, 44, 72] ms showing Q1=22, Q2=30, Q3=38, IQR=16 ms ignoring the 72 ms latency spike
Diagram 1: Isolating the central 50% gives IQR = 38 − 22 = 16 ms, filtering out tail distortion that stretches the full range to 60 ms.

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:

  1. Sort Ascending From Min to Max: Rank every observation cleanly from lowest to highest, keeping repeated duplicate numbers in place.
  2. Locate the Overall Median (Q₂): On odd N, pick the exact middle rank (N + 1) ÷ 2. On even N, average the two center items.
  3. 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 even N, split cleanly down the middle with zero overlap.
  4. Subtract Q₃ − Q₁: The resulting difference is your Interquartile Range, expressed in the original data units (dollars, milliseconds, test points, or kilograms). Divide by 2 for 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.

  1. Sort ascending (N = 10): 12, 18, 22, 25, 29, 31, 35, 38, 44, 72.
  2. Find Median (Q₂): Since N = 10 is even, average the 5th value (29) and 6th value (31): Q₂ = (29 + 31) ÷ 2 = 30 ms.
  3. 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.
  4. Calculate IQR and companion metrics: IQR = 38 − 22 = 16 ms. Meanwhile, Full Range = 72 − 12 = 60 ms, meaning the middle 50% covers just 26.7% of the total span (16 ÷ 60). Semi-IQR = 8 ms, and QCD = 16 ÷ (38 + 22) = 0.2667.
  5. Check outliers: Upper inner fence is 38 + 1.5(16) = 62 ms. Thus the 72 ms latency spike is flagged as a Mild Outlier while core performance holds tight within a 16 ms band.

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 median Q₂ = (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 48 sits between 42.5 and 56.0 (Mild Outlier). Observation 86 exceeds 56.0 (Extreme Outlier). The Box Plot upper whisker pulls back strictly to 29 (the largest inlier inside 42.5), and trimming [48, 86] drops the average cycle time from 31.4 down to 22.5.
Tukey 1.5x and 3.0x IQR outlier fence diagram showing Q1=20, Q3=29, IQR=9, Inner Fence 42.5, Outer Fence 56.0, Mild Outlier 48, and Extreme Outlier 86
Diagram 2: Visualizing how Tukey 1.5×IQR (amber zone) and 3.0×IQR (red zone) separate Mild Outliers (48) from Extreme Outliers (86).

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₃.

Side-by-side infographic comparing Standard Deviation and IQR on symmetric bell data (s=6.56, IQR=10.0) versus skewed data with outlier 86 (s spikes to 21.22 while IQR stays 9.0)
Diagram 3: On clean bell curves IQR ≈ 1.349 × σ, whereas adding one extreme tail spike triples Standard Deviation while leaving IQR anchored on the middle 50%.
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.EXC cleanly on standard odd ranks (N = 4k + 3 or N = 10). It omits the overall median when N is odd before taking lower and upper half medians.
  • Inclusive Linear Method (Excel QUARTILE.INC, Google Sheets QUARTILE, NumPy & R Default): Interpolates along pos = 1 + p × (N − 1) for p = 0.25 and p = 0.75. Including endpoints slightly pulls Q₁ and Q₃ inward toward the center on odd N.
Excel / Sheets Exclusive IQR: =QUARTILE.EXC(A2:A11, 3) - QUARTILE.EXC(A2:A11, 1)
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 within Median ± 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 as 15%) 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

  1. Computing IQR Before Sorting: Taking the 25th and 75th positions from an unsorted list yields meaningless numbers. Always sort ascending first.
  2. 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.
  3. Expecting Zero Outliers Whenever IQR Is Small: In fact, a tight, small IQR shrinks the 1.5 × IQR fences, making moderate tail points more likely to be flagged as outliers than in high-variance datasets!
  4. 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 odd N.
  5. 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), then Q₁ = Q₃ = 0 and IQR = 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:

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