Upper and Lower Fence Calculator

Upper and Lower Fence Calculator

Calculate Tukey's inner and outer fences for a dataset and sort any values beyond them into mild and extreme outliers.

Inner: Q1 − 1.5 × IQR, Q3 + 1.5 × IQR · Outer: Q1 − 3 × IQR, Q3 + 3 × IQR

At least 4 values. The chips above choose how the quartiles are worked out.

Enter at least 4 values to find their fences

What are Upper and Lower Fences?

Fences are cut-off points built from the quartiles that mark where unusual values begin. Values beyond the inner fences (1.5 × IQR outside the box) are outliers; values beyond the outer fences (3 × IQR outside) are extreme outliers.

John Tukey introduced them alongside the box plot as a simple, robust way to flag odd values. Because they're built from quartiles, a single wild value can't drag them outwards and hide itself.

In a box plot, the whiskers stop at the last data point inside the inner fences. Anything beyond is drawn as a separate dot, often with a different symbol for extreme outliers.

Inner and Outer Fence Formulas

Fences as defined by Tukey (1977) and given in the NIST/SEMATECH e-Handbook. See Sources.

1. Find the quartiles and IQR

IQR = Q3 − Q1

2. Inner fences

Q1 − 1.5 × IQR and Q3 + 1.5 × IQR

For normal data about 0.7% of values land beyond these by chance.

3. Outer fences

Q1 − 3 × IQR and Q3 + 3 × IQR

For normal data only about 1 value in 400,000 lands beyond these, so an extreme outlier almost always deserves a closer look.

Worked Example: An Extreme Outlier

Given:
Seven values 2, 4, 5, 7, 8, 12, 50.
Step 1:
Quartiles (median excluded from the halves):
2, 4, 5 → Q1 = 4 · 8, 12, 50 → Q3 = 12 · IQR = 8
Step 2:
Inner fences (1.5 × 8 = 12):
4 − 12 = −8 and 12 + 12 = 24
Step 3:
Outer fences (3 × 8 = 24):
4 − 24 = −20 and 12 + 24 = 36
Result:
50 is an extreme outlier

It lies beyond the upper outer fence of 36. That's worth checking against the source: it could easily be a typing error for 5.0.

How the Quartile Method Moves the Fences

The worked example under each quartile convention. With small datasets the choice can decide whether a value is flagged.

Fences for the example data under three quartile methods
MethodIQRUpper innerUpper outer
Median of halves82436
Inclusive (Excel QUARTILE.INC)5.518.2526.5
Exclusive (Excel QUARTILE.EXC)82436

Common Fence Mistakes

  • Using 1.5 × the range. The fences use the interquartile range, Q3 − Q1, not max − min.
  • Adding 1.5 × IQR to the median. The fences start from Q1 and Q3, the edges of the box.
  • Drawing whiskers to the fences. Fences are cut-offs, not data. Whiskers end at the last real value inside them.
  • Worrying about impossible fences. A lower fence of −8 for counts just means no low outliers are possible.

Upper and Lower Fence FAQs

Why 1.5 and 3?

They’re Tukey’s conventions. 1.5 × IQR catches values that are unusual but not impossible for normal data; 3 × IQR catches values so far out that chance alone almost never explains them.

Do fences assume normal data?

No, they work on any data. But the “0.7% by chance” figure is for normal data; skewed data will naturally have more values beyond one fence.

What if the IQR is zero?

Then all four fences equal Q1 and Q3, and any different value is flagged. That happens when more than half the values are identical.

Is a value exactly on a fence an outlier?

Conventionally no: only values strictly beyond the fence are flagged.

What did Tukey call the values beyond the fences?

He called values between the inner and outer fences “outside” and values beyond the outer fences “far out”.

Why do my textbook’s fences differ from this?

Probably a different quartile method. Pick the matching chip: the halves method is common in school courses, QUARTILE.INC in Excel.

How do I calculate the fences in Excel?

With Q1 in A1 and Q3 in A2: =A1-1.5*(A2-A1) and =A2+1.5*(A2-A1). Use 3 instead of 1.5 for the outer fences.

Should I remove values beyond the fences?

Not automatically. Check whether they’re errors. Genuine extremes are part of the data and removing them hides real variation.

Sources

Related Tools