Skip to content
Statistics

Upper and Lower Fence Calculator

Paste or type your dataset and this calculator finds the lower and upper fences using Tukey's method, flags every mild and extreme outlier, and shows the full step-by-step working. The inner fences use a 1.5 multiplier (the standard boxplot rule), and the outer fences use 3. Results update as you type.

Your details

Enter numbers separated by commas, spaces, or line breaks. At least 4 values are needed to compute quartiles.
Inner fences (1.5 x IQR) flag mild outliers and are used in standard boxplots. Outer fences (3 x IQR) flag extreme outliers only.
Lower fence1 mild outlier detected
-1.75

Q1 minus 1.5 x IQR. Values below this are mild outliers.

Upper fence22.25
Q1 (25th percentile)7.25
Q3 (75th percentile)13.25
IQR (interquartile range)6
Lower outer fence-10.75
Upper outer fence31.25
Mild outlier count1
Extreme outlier count1
Mild outliers85.00
Extreme outliers85.00
Median (Q2)9.5
Data points10
Q17.25
Median9.5
Q313.25
IQR6

1 mild outlier detected outside [-1.7500, 22.2500].

  • The interquartile range (IQR) is 6.0000, so the inner fences sit 9.0000 units beyond Q1 and Q3.
  • 1 value (10.0% of the data) lies beyond the inner fences and is classified as mild outliers.
  • 1 value also exceed the outer fences (3 x IQR) and is classified as extreme outliers.
  • Outliers are not always errors - they may reflect genuine variability, measurement differences, or interesting edge cases worth investigating.

Next stepReview the flagged value to determine whether they reflect data-entry errors, genuine extremes, or subgroup differences before deciding whether to exclude them.

Formula

IQR=Q3Q1,LF=Q11.5×IQR,UF=Q3+1.5×IQR\text{IQR} = Q_3 - Q_1,\quad LF = Q_1 - 1.5 \times \text{IQR},\quad UF = Q_3 + 1.5 \times \text{IQR}

Worked example

Dataset: 2, 5, 7, 8, 9, 10, 11, 14, 18, 85. Sorted: 2, 5, 7, 8, 9, 10, 11, 14, 18, 85. Q1 = 6.5, Q3 = 13.25, IQR = 6.75. Lower fence = 6.5 - 1.5 x 6.75 = -3.625. Upper fence = 13.25 + 1.5 x 6.75 = 23.375. The value 85 exceeds 23.375 and is flagged as a mild outlier.

What are upper and lower fences?

Upper and lower fences are threshold values that mark the boundaries beyond which a data point is considered an outlier. They were introduced by the statistician John Tukey as part of his exploratory data analysis framework in the 1970s and remain the most widely used outlier-detection rule in descriptive statistics. The inner fences are placed 1.5 times the interquartile range below Q1 and above Q3. Any observation outside these limits is called a mild outlier. The outer fences extend to 3 times the IQR and define extreme outliers: values so far from the bulk of the data that they almost certainly warrant investigation. In a perfectly normal distribution, about 0.7% of values fall beyond the inner fences, so flagging them is specific enough to be useful without being so strict that it overwhelms you with false positives.

How the calculation works

The process has four steps. First, sort your data and find the first quartile (Q1, the 25th percentile) and the third quartile (Q3, the 75th percentile). Second, compute the interquartile range (IQR = Q3 - Q1), which measures the spread of the middle half of the data and is resistant to the influence of extreme values. Third, calculate the inner fences: lower fence = Q1 - 1.5 x IQR, upper fence = Q3 + 1.5 x IQR. Fourth, scan the dataset: any value below the lower fence or above the upper fence is a mild outlier. If you also want to distinguish extreme outliers, apply the same logic with a multiplier of 3 to get the outer fences.

Inner versus outer fences: mild and extreme outliers

Tukey defined two tiers of outlier. Mild outliers lie beyond the inner fences (1.5 x IQR from Q1 or Q3) but within the outer fences (3 x IQR). They are unusual but not necessarily wrong: rounding errors, natural variability in a skewed distribution, or genuine but rare events can all produce mild outliers. Extreme outliers lie beyond the outer fences. They are so far from the bulk of the data that they often indicate measurement errors, data-entry mistakes, or fundamentally different subpopulations. When you look at a standard boxplot, the whiskers extend to the last data point that still falls inside the inner fences, and any points beyond the whiskers are plotted individually as dots. This calculator computes both sets of fences and flags which values fall into each category.

When to remove outliers (and when not to)

Detecting outliers with the fence method is only the first step. Whether to remove them depends on why they are there. If an outlier is confirmed as a data-entry error or a sensor malfunction, removing it is justified. If it is a genuine, correctly measured value, removing it biases your analysis and can hide important real-world variation. In medical or financial data, extreme values may be the most important values in the whole dataset. The right approach is to report the analysis both with and without the flagged points, explain your reasoning, and be transparent. For machine learning pipelines, a common practice is to winsorize rather than delete: replace values beyond the fences with the fence value itself, preserving the row while limiting its leverage on the model.

Tukey's fence multipliers and outlier classification

Multiplier (k)Fence typeOutlier classTypical use
1.5Inner fenceMild outlierStandard boxplot, EDA, most textbooks
3Outer fenceExtreme outlierSevere anomaly detection
2CustomModerate (non-standard)Some domain-specific rules
1NarrowAggressive screeningFlags too much normal data

Standard multipliers used in exploratory data analysis. The 1.5 rule is the default for boxplots.

Frequently asked questions

What is the formula for the upper and lower fence?

Lower fence = Q1 - 1.5 x IQR, where Q1 is the first quartile and IQR = Q3 - Q1. Upper fence = Q3 + 1.5 x IQR. Any data value below the lower fence or above the upper fence is a mild outlier by Tukey's standard rule.

Why is the multiplier 1.5?

Tukey chose 1.5 empirically. He explained that a multiplier of 1.0 would flag too many normal observations, while 2.0 would miss too many real outliers. In a normal distribution the 1.5 rule flags roughly 0.7% of values, which is specific enough to be useful without producing constant false alarms.

What is the difference between the inner and outer fence?

The inner fence uses a multiplier of 1.5 and identifies mild outliers. The outer fence uses 3 and identifies extreme outliers. A value between the inner and outer fence is unusual but not necessarily erroneous. A value beyond the outer fence is so extreme that it almost always needs investigation.

Does the IQR method work for all distributions?

It works best for roughly symmetric or unimodal distributions. For strongly skewed data the IQR method can flag many high-end values as outliers simply because the right tail is long, not because those values are genuinely anomalous. In that case, log-transforming the data first or using an asymmetric fence rule may be more appropriate.

What is the IQR and how is it computed?

IQR stands for interquartile range and equals Q3 minus Q1. It measures the spread of the middle 50% of the data. Because it focuses on the central half, it is resistant to the influence of extreme values at either end of the distribution, which is exactly what makes it useful as the basis for a fence-based outlier rule.

Can I use fences on small datasets?

Yes, but interpret results with caution. With fewer than 10 to 15 observations, quartile estimates are unstable, and the fence positions can shift substantially with the addition or removal of a single value. Use fences on small datasets as a rough guide rather than a definitive rule.

Sources

Written by Dr. Hannah Brandt, PhD Statistician · Munich, Germany

Applied statistician translating rigorous probability theory into clear, accurate tools for researchers and practitioners.

Search 3,500+ calculators

Loading search…