IRAF

Math & Statistics

Interquartile Range and Fence Calculator

Calculate IQR, lower and upper Tukey fences, observation-to-fence distances, median position inside the IQR, and the complete central-width reconciliation. The page explains why fences are review rules rather than automatic outlier verdicts.

Interquartile range-
Lower Tukey fence-
Upper Tukey fence-
Low observation minus lower fence-
Upper observation minus upper fence-
Median position within IQR-
Q3 minus Q1-

Decision view

Box plot with Tukey fences and observations

Box plot with Tukey fences and observationsThe central box, median, entered fence multiplier, and low/high observations share a distribution scale.
Exact scenario comparisonFence multiplier changes while all other entered assumptions remain constant.
Fence multiplierInterquartile rangeLower Tukey fenceUpper Tukey fenceLow observation minus lower fenceUpper observation minus upper fenceMedian position within IQRQ3 minus Q1

How to use Interquartile Range and Fence Calculator

  1. Enter Q1, median, and Q3 from one stated quartile algorithm.
  2. Confirm Q1 is no greater than the median and the median is no greater than Q3.
  3. Choose the fence multiplier required by the analysis.
  4. Compare observations with fences as review signals, not automatic deletion rules.

Calculator guide

Understanding Interquartile Range and Fence Calculator

The interquartile range measures the width of the middle half of an ordered dataset. This calculator extends that width into Tukey-style fences and places entered low and high observations against the box, median, and fence positions.

Central half IQR summarizes the middle 50% of ordered data.
Multiplier controls reach Changing k moves fences, not quartiles.
Box shows asymmetry Median position reveals unequal spacing inside the IQR.
Flags need review Fence crossing is not an automatic exclusion rule.

Calculation method

How the calculation works

Subtract Q1 from Q3 and extend entered multiples of that interval below and above the quartiles, retaining observation-to-fence distances. In the Interquartile Range and Fence Calculator, the live scenario varies fence multiplier and tracks upper tukey fence while the remaining results preserve the reconciliation path. Subtract Q1 from Q3 to obtain the IQR. Multiply IQR by the entered fence multiplier, subtract that amount from Q1 for the lower fence, and add it to Q3 for the upper fence.

Detailed calculation process

Build the central box and Tukey fences

The default quartiles define a 15-unit central box, while the 1.5 multiplier extends the review limits beyond both quartiles.

General formula: IQR = Q3 - Q1; LF = Q1 - k x IQR; UF = Q3 + k x IQR IQR measures the central quartile width. The multiplier k extends that same width below Q1 and above Q3 to create symmetric fence rules around the box.

What each symbol means

Q1 First quartile in the observation's units.
Q3 Third quartile in the observation's units.
IQR Interquartile range in the observation's units.
k Nonnegative fence multiplier, dimensionless.
LF / UF Lower and upper Tukey fences in the observation's units.
M Entered median, positioned within the central box.

Worked substitution with the default inputs

1. Find the central width: 39 - 24 = 15 The middle 50% spans 15 units from Q1 to Q3.
2. Scale the fence extension: 1.5 x 15 = 22.5 The same 22.5-unit extension is used on each side.
3. Calculate the lower fence: 24 - 22.5 = 1.5 The entered low observation of 8 remains 6.5 units above this fence.
4. Calculate the upper fence: 39 + 22.5 = 61.5 The entered high observation of 61 remains 0.5 unit below this fence.
5. Locate the median in the box: (31 - 24) / 15 x 100 = 46.67% The median lies slightly left of the IQR midpoint, measured from Q1 toward Q3.

The defaults give IQR = 15, fences at 1.5 and 61.5, and both entered observations inside the fence interval.

Distribution audit

Read the box, whiskers, and observations separately

Each part of the diagram answers a different distribution question.

Box Middle-half interval from Q1 to Q3.
Median Center line inside the box.
Fences Rule-based review boundaries determined by k.
Observations Entered values assessed against those boundaries.

Worked situations

Practical examples

  • Q1 = 24 and Q3 = 39 produce an IQR of 15.
  • At k = 1.5, the upper fence is 61.5, so an entered value of 61 is still inside.
  • Increasing k widens both fences while leaving the IQR unchanged.

Better inputs

Useful tips

  • Record the quartile algorithm because small samples can produce different Q1 and Q3 values.
  • Inspect flagged observations for context, unit errors, and genuine rare cases.
  • Report quartiles and fences with the original measurement units.

Before relying on the result

Limitations and common mistakes

  • Quartile definitions differ across software and sample sizes.
  • A Tukey fence is not a probabilistic test and does not prove an observation is erroneous.
  • Entered quartiles without ordering validation can produce a negative or incoherent IQR.

Reference

Key terms

Interquartile range
Q3 minus Q1, representing the middle-half width.
Tukey fence
Quartile plus or minus a selected multiple of IQR.
Median position
Median's relative location from Q1 to Q3.
Flagged observation
Observation beyond a selected fence and therefore marked for review.

Important note

Calculated directly from the entered values using the displayed formula and rounding settings.

Frequently asked questions

Is every value outside a fence an outlier?

It is a Tukey-fence flag for review, not proof of error or an instruction to remove the value.

Why can quartile software disagree?

Several valid interpolation and rank conventions exist, especially for small datasets.

What happens when Q1 equals Q3?

IQR becomes zero and both fences collapse to the quartile value, so the distribution and data quality need careful review.

Does the median have to be halfway between Q1 and Q3?

No. Its relative position can reveal asymmetry within the central half.