Quartile Calculator

Enter up to ten numbers and how many to use. You get the three quartiles, the interquartile range, the minimum and maximum, and the 1.5 x IQR fences used to flag outliers.

Updated

Embed this calculator

Paste this code into your page. The calculator runs inside the frame and links back to the full version.

Keep the credit link in place. Do not resell the calculator.

Method

Quartiles use linear interpolation, the same as Excel QUARTILE.INC / PERCENTILE.INC (R type 7). Other textbook methods (for example the median of each half) can give slightly different Q1 and Q3.

Formula

Sort the n numbers. For q = 0.25, 0.5, 0.75: rank = q × (n - 1), i = floor(rank), Q = x[i] + (rank - i) × (x[i+1] - x[i]), counting positions from 0.

  • IQR = Q3 - Q1
  • lower fence = Q1 - 1.5 × IQR
  • upper fence = Q3 + 1.5 × IQR
  • A number outside the fences is counted as a possible outlier.

Worked example

Numbers 7, 1, 3, 9, 5, 11, 2, 8, 6, 4 sort to 1, 2, 3, 4, 5, 6, 7, 8, 9, 11 (n = 10).

  • Q1: rank 0.25 × 9 = 2.25, so 3 + 0.25 × (4 - 3) = 3.25
  • Q2: rank 4.5, so 5 + 0.5 × (6 - 5) = 5.5
  • Q3: rank 6.75, so 7 + 0.75 × (8 - 7) = 7.75
  • IQR = 7.75 - 3.25 = 4.5
  • Fences: 3.25 - 6.75 = -3.5 and 7.75 + 6.75 = 14.5, so no outliers

Frequently asked questions

How are quartiles calculated?

Sort the numbers and take the values 25%, 50% and 75% of the way along, using linear interpolation at rank q x (n - 1). For 15, 20, 35, 40, 50, Q1 is at rank 1 (20), Q2 at rank 2 (35) and Q3 at rank 3 (40).

What is the interquartile range?

The IQR is Q3 minus Q1, the spread of the middle half of the data. For 15, 20, 35, 40, 50 it is 40 - 20 = 20. Unlike the full range it is not affected by extreme values.

How do the outlier fences work?

Tukey fences flag a value as a possible outlier if it is below Q1 - 1.5 x IQR or above Q3 + 1.5 x IQR. For 3, 3, 3, 10: Q1 = 3, Q3 = 4.75, IQR = 1.75, so the upper fence is 7.375 and 10 is flagged.

Why do other calculators give different quartiles?

Quartile methods differ. This page uses the inclusive linear method (Excel QUARTILE.INC, R type 7). The "median of halves" method taught in some textbooks, and exclusive methods, can give different Q1 and Q3 for the same data.

Does the order of my numbers matter?

No. The numbers are sorted first, so 7, 1, 3, 9, 5, 11, 2, 8, 6, 4 gives Q1 = 3.25, Q2 = 5.5 and Q3 = 7.75 in any order.