Interquartile Range Calculator Formula
Understand the math behind the interquartile range calculator. Each variable explained with a worked example.
Formulas Used
Interquartile Range (IQR)
iqr = q3 - q1Lower Fence (Q1 - 1.5*IQR)
lower_fence = q1 - 1.5 * (q3 - q1)Upper Fence (Q3 + 1.5*IQR)
upper_fence = q3 + 1.5 * (q3 - q1)Variables
| Variable | Description | Default |
|---|---|---|
q1 | First Quartile (Q1) | 25 |
q3 | Third Quartile (Q3) | 75 |
How It Works
How to Calculate the Interquartile Range
Formula
IQR = Q3 - Q1
Q1 is the value below which 25% of observations fall, and Q3 is the value below which 75% fall. The IQR captures the spread of the middle 50% of the data, ignoring extreme tails.
Outlier Fences
Values below Q1 - 1.5*IQR or above Q3 + 1.5*IQR are considered potential outliers by the Tukey fence rule.
Worked Example
A dataset has Q1 = 25 and Q3 = 75. Find the IQR and outlier fences.
q1 = 25q3 = 75
- 01IQR = 75 - 25 = 50
- 02Lower Fence = 25 - 1.5 * 50 = 25 - 75 = -50
- 03Upper Fence = 75 + 1.5 * 50 = 75 + 75 = 150
- 04Any value below -50 or above 150 is a potential outlier
Ready to run the numbers?
Open Interquartile Range Calculator