Quartile Calculator
- Sorted, the 6 values run from 4.00 to 42.00.
- The median (Q2) is 15.50; the lower half medians to Q1 = 8.00 and the upper half to Q3 = 23.00 (Tukey's hinge method).
- IQR = 23.00 - 8.00 = 15.00.
- The 1.5 × IQR fences sit at -14.50 and 45.50; values outside them: none.
This quartile calculator splits your ordered data into quarters using Tukey's hinge method, where Q1 is the median of the lower half, Q2 is the overall median, and Q3 is the median of the upper half. When the count is odd, the median itself is excluded from both halves. Enter your values and the calculator returns Q1, Q2, Q3, the interquartile range (IQR), and outlier fences. For example, the data set 4, 8, 15, 16, 23, 42 yields Q1 = 8.00, a median of 15.50, Q3 = 23.00, and an IQR of 15.00, with outlier fences at -14.50 and 45.50, so nothing is flagged. Enter 5, 7, 8, 9, 10, 12, 14, 88 and you get Q1 = 7.50, a median of 9.50, Q3 = 13.00, and an IQR of 5.50; the upper fence is 21.25, so 88 is flagged as an outlier.
Tukey's hinge method is the accepted standard here because the IQR is the standard measure of spread for box plots — it resists outliers, unlike the range, which ignores the extreme values entirely. Different quartile conventions (inclusive versus exclusive medians, percentile interpolation) can give slightly different Q1 and Q3 on small data sets, so this calculator states and uses Tukey's hinge method to keep results consistent. Below, this page shows the formula, step-by-step workings, worked examples, and sources so you can verify every result yourself.
Worked examples
A six-number spread
Primary result: 15.00 — Q1 of 8.00 and Q3 of 23.00 bracket the middle half of the data. (6 numbers · 4 · 8 · 15 · 16 · 23 · 42 · 0 · 0)
| Interquartile range (IQR) | 15.00 |
| First quartile (Q1) | 8.00 |
| Median (Q2) | 15.50 |
| Third quartile (Q3) | 23.00 |
| Range | 38.00 |
| Outliers (1.5 × IQR rule) | none |
Perfectly even spacing
Primary result: 30.00 — quartiles land at 15.00 and 45.00 around a median of 30.00. (5 numbers · 10 · 20 · 30 · 40 · 50 · 42 · 0 · 0)
| Interquartile range (IQR) | 30.00 |
| First quartile (Q1) | 15.00 |
| Median (Q2) | 30.00 |
| Third quartile (Q3) | 45.00 |
| Range | 40.00 |
| Outliers (1.5 × IQR rule) | none |
The outlier shows up
Primary result: 5.50 — a tight IQR makes the upper fence 21.25, so 88 is flagged as an outlier. (8 numbers · 5 · 7 · 8 · 9 · 10 · 12 · 14 · 88)
| Interquartile range (IQR) | 5.50 |
| First quartile (Q1) | 7.50 |
| Median (Q2) | 9.50 |
| Third quartile (Q3) | 13.00 |
| Range | 83.00 |
| Outliers (1.5 × IQR rule) | 88.00 |
What quartiles describe
Quartiles split ordered data into quarters: Q1 is the median of the lower half, Q2 the overall median and Q3 the median of the upper half. This calculator uses Tukey's hinge method, which excludes the median itself from the halves when the count is odd. Together with the minimum and maximum, these three values form the five-number summary, which in turn feeds the box plot. The box plot displays the range from Q1 to Q3 as a box, with a line at the median and whiskers extending to the most extreme values that are not outliers. It is one of the most common visual summaries of a data set's distribution.
Quartiles and the interquartile range (IQR) are considered robust statistics because they resist outliers. The IQR is the standard measure of spread for box plots because it resists outliers — unlike the range, it ignores the extreme values entirely. A single extreme value can distort the range dramatically, but the IQR depends only on the middle 50% of the data, so it remains stable even when a few points are far from the rest. This stability makes quartiles useful for comparing the spread of data sets that may contain unusual or erroneous values.
Outlier detection in box plots relies on the IQR. Values that fall below Q1 minus 1.5 times the IQR or above Q3 plus 1.5 times the IQR are flagged as outliers. For example, the values 4, 8, 15, 16, 23, 42 give Q1 = 8.00, a median of 15.50, Q3 = 23.00 and an IQR of 15.00, with outlier fences at -14.50 and 45.50, so nothing is flagged. A simpler set of 10, 20, 30, 40, 50 gives Q1 = 15.00, a median of 30.00, Q3 = 45.00 and an IQR of 30.00, with no outliers. In contrast, the values 5, 7, 8, 9, 10, 12, 14, 88 give Q1 = 7.50, a median of 9.50, Q3 = 13.00 and an IQR of 5.50; the upper fence is 21.25, so 88 is flagged as an outlier.
Different quartile conventions (inclusive versus exclusive medians, percentile interpolation) can give slightly different Q1 and Q3 on small data sets. This calculator states and uses Tukey's hinge method, so the results will be consistent and transparent. When using a quartile calculator to compare data across sources, it is worth checking which method each source applies, since the differences can be noticeable on small samples but usually minor on larger ones.
Tukey's hinge method, step by step
Tukey's hinge method is the approach this quartile calculator uses, and it follows three clear steps. First, sort your data from smallest to largest. Second, find the overall median, which is Q2. Third, split the data into a lower half and an upper half at that median, then find the median of each half. The median of the lower half is Q1, and the median of the upper half is Q3. When the total count is odd, Tukey's hinge method excludes the median itself from both halves. When the count is even, the split is clean and every value belongs to one half or the other.
A verified walkthrough shows how this works with six values. Start with 4, 8, 15, 16, 23 and 42, already in order. The count is even, so the overall median falls between the third and fourth values: the average of 15 and 16 gives a median of 15.50. That splits the data into a lower half of 4, 8 and 15, and an upper half of 16, 23 and 42. The median of the lower half is 8.00, so Q1 equals 8.00. The median of the upper half is 23.00, so Q3 equals 23.00. The interquartile range, or IQR, is Q3 minus Q1, which is 15.00. Outlier fences sit 1.5 IQR below Q1 and above Q3, at -14.50 and 45.50. Since every value in the data set falls inside those fences, nothing is flagged as an outlier.
The same method applies when the count is odd. Take the five values 10, 20, 30, 40 and 50. The median is the middle value, 30.00, and Tukey's hinge method excludes that value from both halves. The lower half becomes 10 and 20, with a median of 15.00 for Q1. The upper half becomes 40 and 50, with a median of 45.00 for Q3. The IQR is 30.00.
An eight-value example shows the outlier fence in action. For 5, 7, 8, 9, 10, 12, 14 and 88, the median falls between the fourth and fifth values, giving 9.50. The lower half is 5, 7, 8 and 9, with Q1 equal to 7.50. The upper half is 10, 12, 14 and 88, with Q3 equal to 13.00. The IQR is 5.50, and the upper fence is 21.25. Because 88 sits well above that fence, it is flagged as an outlier. The IQR is the standard measure of spread for box plots because it resists outliers. Unlike the range, it ignores the extreme values entirely, so a single large or small number cannot distort the result.
Worked examples
Quartiles split ordered data into quarters: Q1 is the median of the lower half, Q2 the overall median and Q3 the median of the upper half (Tukey's hinge method, which excludes the median itself from the halves when the count is odd). Different quartile conventions (inclusive versus exclusive medians, percentile interpolation) can give slightly different Q1 and Q3 on small data sets; this calculator states and uses Tukey's hinge method so you always know which rule is being applied.
The table below shows three verified data sets that our quartile calculator processes. The first data set, 4, 8, 15, 16, 23, 42, gives Q1 = 8.00, a median of 15.50, Q3 = 23.00 and an IQR of 15.00, with outlier fences at -14.50 and 45.50, so nothing is flagged. The second data set, 10, 20, 30, 40, 50, gives Q1 = 15.00, a median of 30.00, Q3 = 45.00 and an IQR of 30.00. The third data set, 5, 7, 8, 9, 10, 12, 14, 88, gives Q1 = 7.50, a median of 9.50, Q3 = 13.00 and an IQR of 5.50; the upper fence is 21.25, so 88 is flagged as an outlier.
Notice how the third data set demonstrates exactly why the IQR is the standard measure of spread for box plots because it resists outliers — unlike the range, it ignores the extreme values entirely. The value 88 sits far above the upper fence of 21.25, yet the IQR of 5.50 stays small and stable, reflecting the tight clustering of the other seven values. The range, by contrast, would stretch from 5 to 88 and paint a misleading picture of where most of the data actually sits.
These examples also highlight why stating the quartile method matters. With only five or six values, inclusive and exclusive median conventions can produce Q1 and Q3 values that differ by a unit or more, which in turn shifts the outlier fences. Tukey's hinge method gives you a consistent, transparent rule: when the count is odd, the overall median is set aside before the lower and upper halves are determined. That consistency is what makes the results reproducible and trustworthy.
| Data set | Q1 | Median (Q2) | Q3 | IQR | Outlier fences | Outliers flagged |
|---|---|---|---|---|---|---|
| 4, 8, 15, 16, 23, 42 | 8.00 | 15.50 | 23.00 | 15.00 | -14.50 and 45.50 | None |
| 10, 20, 30, 40, 50 | 15.00 | 30.00 | 45.00 | 30.00 | Not specified | Not specified |
| 5, 7, 8, 9, 10, 12, 14, 88 | 7.50 | 9.50 | 13.00 | 5.50 | Upper fence 21.25 | 88 |
The interquartile range
The interquartile range, or IQR, is the difference between Q3 and Q1. Because Q1 marks the boundary of the lowest quarter of ordered data and Q3 marks the boundary of the highest quarter, the IQR captures the spread of the middle half. Quartiles split ordered data into quarters: Q1 is the median of the lower half, Q2 the overall median and Q3 the median of the upper half. This quartile calculator uses Tukey's hinge method, which excludes the median itself from the halves when the count is odd.
The IQR is the standard measure of spread for box plots because it resists outliers. Unlike the range, which is simply the maximum minus the minimum, the IQR ignores the extreme values entirely. This matters most with skewed data or data sets containing outliers, where the range can be misleading. Consider the values 5, 7, 8, 9, 10, 12, 14, 88. Here Q1 is 7.50, the median is 9.50, Q3 is 13.00 and the IQR is 5.50. The range would be 83, suggesting enormous variability, but the IQR of 5.50 reveals that the middle half of the data is tightly clustered. The upper outlier fence sits at 21.25, so the value 88 is flagged as an outlier rather than allowed to distort the measure of spread.
By contrast, a data set without outliers shows a more stable picture. For the values 10, 20, 30, 40, 50, the IQR is 30.00, with Q1 at 15.00, a median of 30.00 and Q3 at 45.00. Nothing here is extreme, so the IQR and the range tell broadly consistent stories about spread. The same holds for 4, 8, 15, 16, 23, 42, where Q1 is 8.00, the median is 15.50, Q3 is 23.00 and the IQR is 15.00. The outlier fences fall at -14.50 and 45.50, so nothing is flagged.
One point worth noting is that different quartile conventions, such as inclusive versus exclusive medians or percentile interpolation, can give slightly different Q1 and Q3 values on small data sets. This calculator states and uses Tukey's hinge method so results stay consistent and transparent.
Outlier fences at 1.5 × IQR
Once a quartile calculator reports Q1 and Q3, the interquartile range follows directly: IQR = Q3 − Q1. The IQR is the standard measure of spread for box plots because it resists outliers — unlike the range, it ignores the extreme values entirely. Outlier fences then extend 1.5 × IQR above Q3 and below Q1, and any data point beyond those fences gets flagged as an outlier.
Consider the ordered set 5, 7, 8, 9, 10, 12, 14, 88. Using Tukey's hinge method — which excludes the median itself from the halves when the count is odd — the quartile calculator returns Q1 = 7.50, a median of 9.50, Q3 = 13.00, and an IQR of 5.50. The upper fence sits at Q3 + 1.5 × IQR, which equals 13.00 + 8.25 = 21.25. The value 88 lies far above 21.25, so it is flagged as an outlier. The lower fence, at Q1 − 1.5 × IQR, equals 7.50 − 8.25 = −0.75, and no value falls below it.
Now compare that with the set 4, 8, 15, 16, 23, 42. Here the quartile calculator gives Q1 = 8.00, a median of 15.50, Q3 = 23.00, and an IQR of 15.00. The outlier fences land at −14.50 and 45.50. The value 42 sits comfortably inside the upper fence of 45.50, so nothing is flagged. This shows how a wider IQR expands the fence range and keeps larger values inside the normal spread.
Different quartile conventions — inclusive versus exclusive medians, percentile interpolation — can give slightly different Q1 and Q3 on small data sets. This calculator states and uses Tukey's hinge method, so the fence values match the examples above exactly.
Why quartile methods differ
Quartiles split ordered data into quarters: Q1 is the median of the lower half, Q2 the overall median, and Q3 the median of the upper half. That sounds simple enough, but statisticians and software developers have never fully agreed on how to define those halves. The result is that when you enter the same small data set into two different tools, you can get two slightly different answers for Q1 and Q3. This is not a bug in either one; it is a genuine disagreement about quartile methods.
The clearest way to understand the disagreement is to compare Tukey's hinge method with percentile interpolation. Tukey's hinge method, which this quartile calculator states and uses, excludes the median itself from the halves when the count is odd. If you have five values, the middle value belongs to neither the lower half nor the upper half. Percentile interpolation, by contrast, treats the data as a continuous range and estimates quartile positions by interpolating between adjacent data points. On large data sets the two approaches usually converge, but on small data sets they can produce slightly different Q1 and Q3 values.
This is exactly why spreadsheets and textbooks sometimes disagree. Many statistics textbooks teach one convention, while popular spreadsheet programs may default to another. A student who calculates quartiles by hand and then checks the answer in a spreadsheet will occasionally find a small mismatch and assume one of the two is wrong. Neither is wrong; they are simply following different rules for where the quartile boundaries fall.
The IQR is the standard measure of spread for box plots because it resists outliers, unlike the range, which ignores the extreme values entirely. Because quartile conventions can shift Q1 and Q3 slightly, the IQR and the outlier fences derived from it can also shift. On the data set 5, 7, 8, 9, 10, 12, 14, 88, Tukey's hinge method gives Q1 at 7.50, a median of 9.50, Q3 at 13.00, and an IQR of 30.00. The upper fence sits at 21.25, so 88 is flagged as an outlier. A different quartile convention might place Q1 or Q3 a fraction away from those values, but the outlier conclusion would remain the same.
- Tukey's hinge method excludes the median from both halves when the count is odd, giving clean, reproducible quartile boundaries.
- Percentile interpolation estimates quartile positions by interpolating between adjacent data points, which can shift Q1 and Q3 slightly on small sets.
- On large data sets, different conventions usually converge, so the choice of method matters most for small samples.
FAQs
How do you calculate quartiles?
Sort the data, take the median (Q2), then the medians of the lower and upper halves as Q1 and Q3. For the set 4, 8, 15, 16, 23, 42, this gives Q1 = 8.00 and Q3 = 23.00.
What is the interquartile range?
The interquartile range is Q3 minus Q1. In the first verified example, it equals 15.00. In the set containing the outlier 88, it is just 5.50, showing how a compact middle half can still sit beside an extreme value.
How are outliers detected with quartiles?
Values beyond Q1 − 1.5 × IQR or Q3 + 1.5 × IQR are flagged. The verified fence of 21.25 catches the value 88, marking it as an outlier because it falls beyond the upper boundary calculated from the interquartile range.
Why do different calculators give different quartiles?
There are several accepted conventions for placing Q1 and Q3 in small samples. This page uses Tukey's hinges and says so, making the method transparent so you can compare results across tools without confusion.
What is the five-number summary?
The five-number summary is the minimum, Q1, median, Q3 and maximum. For the first verified set, those values are 4, 8.00, 15.50, 23.00 and 42. It gives a quick snapshot of how the data is spread.
Is the median always Q2?
Yes — the second quartile is the median by definition. When you sort the data, the median sits in the middle, and it splits the set into the lower and upper halves used to find Q1 and Q3.