IQR Calculator

Quartile Calculator

Split a data set into quarters. Four methods, side by side, with the halves shown.

Quartiles calculatorRuns entirely in your browser
Separate values with commas, spaces or line breaks. Paste a column straight from a spreadsheet.
Try:
Quartile method

Quartiles have no single agreed definition. Why these differ.

ResultExclusive method · n = 7
Q1 (25th)
2
Q2 · median
4
Q3 (75th)
6
IQR
4
Count
7
Minimum
1
Maximum
7
Range
6
Compare all four quartile methods
MethodQ1MedianQ3IQR
Exclusive2464
Inclusive2.545.53
Interpolation, rank p(n+1)2464
Interpolation, rank (n−1)p+12.545.53

These methods give 2 different answers for this data set. The highlighted row is the method currently selected above.

Box plot

Box and whisker plot of your dataBox plot. Minimum 1, lower whisker 1, Q1 2, median 4, Q3 6, upper whisker 7, maximum 7. No outliers.Interquartile range: Q1 2 to Q3 6, IQR 4Median: 4Q1 2Med 4Q3 6246
Middle 50% (Q1 to Q3)MedianRange within the fences

How we calculated it

Your data, as entered
1, 2, 3, 4, 5, 6, 7
7 values.
Sorted from smallest to largest
1234567
An odd count. The Exclusive method leaves the middle value out of both halves.
Median (Q2)
The middle value of 7 is number 4 → 4
Split into halves
Lower half  →  1, 2, 3Upper half  →  5, 6, 7
Q1 and Q3 are the medians of those halves
Q1 = middle of 3 values = 2Q3 = middle of 3 values = 6
Interquartile range
IQR = Q3 − Q1IQR = 6 − 2 = 4

What a quartile is

Quartiles are the three values that cut sorted data into four groups of equal size. A quarter of the values fall below Q1, half fall below Q2 — which is just the median under another name — and three quarters fall below Q3.

They are percentiles at fixed positions: Q1 is the 25th percentile, Q2 the 50th, Q3 the 75th. Anything the percentile calculator can do at an arbitrary percentage, the quartiles do at those three.

Why methods differ, and which one you want

Every method agrees on the median. They disagree about what to do with the halves on either side of it, and the disagreement is real enough to change your answer.

Exclusive — the textbook rule

Split at the median. If the count is odd, the median belongs to neither half. Q1 is the median of the lower half, Q3 the median of the upper half. This is what a TI-83 or TI-84 reports under 1-Var Stats, and what most introductory courses teach.

Inclusive — Tukey's hinges

Same split, except that with an odd count the median is counted in both halves. The two quartiles move inward compared with the exclusive rule, so the IQR comes out smaller. R's fivenum() produces these.

Interpolation at rank p(n+1)

Rather than splitting into halves, treat the quartile as a position. Compute the rank p(n+1) — for Q1 that is 0.25(n+1) — and if it lands between two values, interpolate linearly between them. This is the rule in the NIST handbook, and the one Excel's QUARTILE.EXC implements.

Interpolation at rank (n−1)p+1

Same idea, different rank formula. This one always lands inside the data, so it never needs clamping at small n. It is the most widely deployed convention in practice, because it is what Excel's QUARTILE.INC, Google Sheets, NumPy and pandas all use by default.

A naming warning

The words "exclusive" and "inclusive" are used inconsistently across the web. Some tools use them for the halves rules above; others use them for Excel's .EXC and .INC functions, which are the two interpolation rules and are unrelated to whether the median joins a half. This site uses those two words only for the halves rules, and names the interpolation methods by their rank formula.

Which method does your software use?

SoftwareFunctionMethod here
TI-83 / TI-841-Var StatsExclusive
Rfivenum()Inclusive
Rquantile(type = 6)Interpolation p(n+1)
Rquantile() default, type 7Interpolation (n−1)p+1
ExcelQUARTILE.EXC, PERCENTILE.EXCInterpolation p(n+1)
ExcelQUARTILE.INC, PERCENTILE.INC, QUARTILEInterpolation (n−1)p+1
Google SheetsQUARTILEInterpolation (n−1)p+1
NumPy / pandasquantile(), describe()Interpolation (n−1)p+1

Pick the matching row in the panel above and this calculator will reproduce that software's answer exactly.

Quartile deviation and the semi-interquartile range

quartile deviation = (Q3 − Q1) ÷ 2 = IQR ÷ 2

Also called the semi-interquartile range. It answers "how far, typically, is a quartile from the median?" rather than "how far apart are the quartiles?" — the same information, halved. It appears in older textbooks more often than in modern practice.

Worked examples

An even count: every method agrees

Data: 4, 8, 15, 16, 23, 42

Six values. The median is (15 + 16) ÷ 2 = 15.5, and the halves are 4, 8, 15 and 16, 23, 42 regardless of which halves rule you apply — there is no middle value to argue over.

Q1 = 8, Q3 = 23, IQR = 15. The exclusive and inclusive methods are identical here. The two interpolation methods still differ, because they position the quartile by rank rather than by splitting: p(n+1) gives Q1 = 7 and (n−1)p+1 gives Q1 = 9.75.

An odd count where all four separate

Data: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49

Eleven values, median 40.

  • Exclusive: Q1 = 15, Q3 = 43
  • Inclusive: Q1 = 25.5, Q3 = 42.5
  • p(n+1): rank 3 and rank 9 land exactly on values → Q1 = 15, Q3 = 43
  • (n−1)p+1: rank 3.5 and 8.5 interpolate → Q1 = 25.5, Q3 = 42.5

The IQR is either 28 or 17 depending on which convention you follow — a difference of 65%. This is the data set to paste in if you want to see the point.

Questions

Is Q2 the same as the median?

Yes, always, under every method. Q2 and the median are two names for the value with half the data below it.

Can Q1 equal Q3?

Yes, when at least half the values are identical. The IQR is then 0, and a box plot drawn from the data collapses to a line.

Which method should I report?

Whichever your audience expects, stated explicitly. In coursework, match the method you were taught. In a paper or report, name the software and function you used — "quartiles computed with R quantile type 7" removes all ambiguity.

Method & sources