Upper and Lower Fence Calculator

Enter a dataset to find its lower and upper fences using Tukey's IQR method, plus Q1, Q3, the interquartile range, and any outliers.

Quick Facts

Method
Tukey's fences: Q1 − k·IQR and Q3 + k·IQR
Standard k = 1.5 flags mild outliers; k = 3 flags extreme ones. Quartiles use linear interpolation (exclusive method).

Your Results

Calculated
Lower fence
-
Q1 − k·IQR
Upper fence
-
Q3 + k·IQR
Q1 / Q3
-
25th / 75th percentile
IQR
-
Q3 − Q1

Ready

Enter your dataset and click Calculate.

What the upper and lower fence are

The upper and lower fences are boundary values used to detect outliers in a dataset. They come from John Tukey's box-and-whisker method and are built entirely from the quartiles of your data. Any observation that falls below the lower fence or above the upper fence is treated as a potential outlier — a value far enough from the bulk of the data to deserve a second look.

The formula

The fences depend on three quantities: the first quartile (Q1, the 25th percentile), the third quartile (Q3, the 75th percentile), and the interquartile range (IQR), which is the spread of the middle half of the data:

  • IQR = Q3 − Q1
  • Lower fence = Q1 − 1.5 × IQR
  • Upper fence = Q3 + 1.5 × IQR

The multiplier 1.5 defines the "inner fences", which flag mild outliers. Using 3.0 instead gives the "outer fences", which mark extreme or far-out outliers. Because the fences are built from quartiles rather than the mean and standard deviation, they are resistant to the very outliers they are meant to detect — a single huge value barely moves Q1 or Q3.

A worked example

Take the dataset 4, 5, 6, 7, 8, 9, 10, 11, 12, 40 (ten values). Using the exclusive method with linear interpolation, Q1 = 5.75 and Q3 = 11.25, so IQR = 5.5. The lower fence is 5.75 − 1.5 × 5.5 = −2.5, and the upper fence is 11.25 + 1.5 × 5.5 = 19.5. The value 40 sits well above the upper fence of 19.5, so it is flagged as an outlier; every other value falls inside the fences.

Why quartile methods vary

There is no single universal definition of a quartile. Textbooks and software differ in how they locate Q1 and Q3 — Tukey's hinges, the "inclusive" (median-included) method, and the "exclusive" method used here can each give slightly different quartiles for the same data, and therefore slightly different fences. This calculator uses the exclusive method with linear interpolation (rank = p × (n + 1)), the same convention used by many statistics courses and by spreadsheet functions like QUARTILE.EXC. Expect small differences if you compare against a tool that uses a different rule.

Frequently Asked Questions

What is the formula for the upper and lower fence?
Lower fence = Q1 − 1.5 × IQR and upper fence = Q3 + 1.5 × IQR, where IQR = Q3 − Q1. Q1 is the 25th percentile and Q3 the 75th percentile. Values below the lower fence or above the upper fence are potential outliers.
Why is the multiplier 1.5?
Tukey chose 1.5 as a practical compromise. For roughly normal data the inner fences flag only about 0.7% of values, so they catch genuinely extreme points without over-flagging ordinary variation. A multiplier of 3.0 gives the outer fences, used to distinguish "far out" extreme outliers from mild ones.
Can a fence be negative or exceed my data range?
Yes, and that is normal. A fence is just Q1 or Q3 shifted by 1.5 × IQR; the result can be negative or larger than any actual value even when the data are all positive. It only means no value on that side qualifies as an outlier. A negative lower fence for strictly positive data simply says nothing is unusually low.
Does flagging a value as an outlier mean I should delete it?
No. The fences identify candidates for review, not values to discard automatically. An outlier may be a data-entry error, or it may be a real, important observation. Investigate the cause before removing anything; deleting genuine extreme values can bias your analysis.