Box Plot Formula: Quartiles, IQR, and Whiskers

Formulas & functions · Updated November 3, 2026

Box Plot Formula: Quartiles, IQR, and Whiskers

A box plot has no single formula: it is built from a five-number summary—minimum, first quartile (Q1), median, third quartile (Q3), and maximum—and often uses the interquartile range (IQR) to identify outliers and set whisker limits. The box runs from Q1 to Q3, the median is marked inside it, and whiskers show the most extreme values included under the chart’s chosen rule.

What the box plot formula describes

A box plot, also called a box-and-whisker plot, summarizes the distribution of numerical data. Rather than displaying every observation, it shows where the middle half of the values lie, where the center falls, and how far the data extend. It is useful for comparing groups, spotting possible outliers, and noticing asymmetry or differences in spread.

The five-number summary supplies the plot’s basic landmarks. The minimum and maximum are the smallest and largest observations; Q1 and Q3 mark the lower and upper quartiles; and the median divides the ordered data into two halves. The box represents the interval from Q1 through Q3. Its width or height is not a measure of sample size unless a chart specifically adds that feature.

Many box plots do not extend their whiskers all the way to the minimum and maximum. Instead, they use the IQR to define outlier fences. Values beyond those fences are drawn as individual points, while the whiskers stop at the most extreme observations still inside the fences. This distinction matters: a point beyond a fence is conventionally flagged as a potential outlier, not automatically judged to be an error.

The five-number summary and IQR

To construct a basic box plot, first sort the observations from smallest to largest. Find the median, then determine Q1 and Q3 using a stated quartile convention. The IQR is the distance from Q1 to Q3: in words, subtract Q1 from Q3. It describes the spread of the central 50% of the data and is less affected by extreme observations than the full range.

The common Tukey rule uses the IQR to calculate two fences. The lower fence is Q1 minus 1.5 times the IQR; the upper fence is Q3 plus 1.5 times the IQR. Observations below the lower fence or above the upper fence are plotted individually as potential outliers. These are screening thresholds, not limits on what values are possible, and the 1.5 multiplier is a convention rather than a law of nature.

For example, if Q1 is 6 and Q3 is 14, the IQR is 8. The lower fence is -6 and the upper fence is 26. A value of 30 would be flagged as a potential high outlier, while a value of 20 would remain within the fences. Whether an observation is actually an error requires context and verification.

Worked example: calculate a box plot

Consider these 11 sorted observations: 2, 4, 5, 7, 8, 10, 12, 13, 15, 18, 21. The median is the sixth observation, 10. Using the inclusive percentile convention described below, Q1 is 6 and Q3 is 14. The IQR is therefore 8, giving fences of -6 and 26. Since every observation falls inside those fences, the whiskers reach 2 and 21 and there are no separately flagged outliers.

This example also shows why a box plot is a summary, not a substitute for the data. It shows the median and quartile locations, but it does not reveal that the values between 2 and 10 are spaced differently from those between 10 and 21. A histogram, dot plot, or the raw observations may be useful alongside it when the shape of the distribution matters.

Quartile methods can change the result

Quartiles are not calculated identically by every textbook, software package, or chart. When the sample size is odd, one method may include the overall median when finding the quartiles of the lower and upper halves; another may leave it out. Other methods use interpolation between ranked observations. As a result, the same data can produce slightly different Q1 and Q3 values, especially in a small sample.

For the example above, taking the median of the lower five values gives Q1 = 5, while taking the median of the upper five gives Q3 = 15. That method gives an IQR of 10, rather than the inclusive-percentile IQR of 8. Neither result is necessarily a calculation error: the methods differ. When comparing plots, check that they use the same quartile definition, particularly if the groups are small or the results are close.

Excel distinguishes inclusive and exclusive quartile calculations. Inclusive quartiles include the endpoints when calculating percentile ranks; exclusive quartiles use a different rank convention and may return different interpolated values. The chart’s quartile setting can also affect its boxes, so a chart and manually calculated values should be compared only after checking that they use matching conventions.

Calculate quartiles in Excel for Microsoft 365

In Excel for Microsoft 365 on Windows, place the example observations in cells A2:A12, one number per cell. With those values in A2:A12, this formula returns the inclusive first quartile, 6: =QUARTILE.INC(A2:A12,1)

With the same data in A2:A12, this formula returns the inclusive third quartile, 14: =QUARTILE.INC(A2:A12,3)

With the same data in A2:A12, this formula returns the median, 10: =MEDIAN(A2:A12)

With the same data in A2:A12, this formula calculates the inclusive IQR, 8: =QUARTILE.INC(A2:A12,3)-QUARTILE.INC(A2:A12,1)

With the same data in A2:A12, this formula calculates the lower fence, -6: =QUARTILE.INC(A2:A12,1)-1.5*(QUARTILE.INC(A2:A12,3)-QUARTILE.INC(A2:A12,1))

With the same data in A2:A12, this formula calculates the upper fence, 26: =QUARTILE.INC(A2:A12,3)+1.5*(QUARTILE.INC(A2:A12,3)-QUARTILE.INC(A2:A12,1))

To make a chart from a dataset, select the values and use Insert > Insert Statistic Chart > Box and Whisker in Excel for Microsoft 365 on Windows. Excel calculates the chart from the selected data. Use the chart’s Format Data Series options to choose inclusive or exclusive median quartiles and to show or hide outlier points. Menu labels and chart options can differ in Excel for Mac or Excel for the web, so check the available chart and series settings in that version.

How to read the box, median, and whiskers

The median line indicates the data’s central value: half the observations lie at or below it and half at or above it, subject to ties. The box length represents the IQR. A longer box means the central half of the observations is more spread out; a shorter box means that central group is more concentrated.

The median’s position inside the box and the whiskers’ relative lengths can hint at skew, but they do not prove a particular distribution shape. For instance, a median closer to Q1 than Q3 may suggest more spread in the upper half of the central data. A long upper whisker may indicate a longer tail toward larger values. These visual clues should be treated as summaries, not as a complete account of the distribution.

When comparing several groups, use the same measurement units and quartile convention. Compare medians for typical values, box lengths for central spread, and whiskers or outlier points for the tails. A box plot alone does not show how many observations fall in each group unless sample sizes are shown separately.

Common mistakes and useful checks

  • Calling every whisker an extreme value: In a Tukey-style plot, a whisker usually ends at the most extreme observation within the fence, not necessarily at the overall minimum or maximum.
  • Treating a flagged point as bad data: Check the original record, units, and collection process. A genuine rare observation can be important and should not be removed just because it lies beyond a fence.
  • Comparing different quartile conventions: Different definitions can shift box edges, especially with few observations. Confirm the calculation method before interpreting small differences.
  • Assuming the box displays all the data’s shape: Many different datasets can share the same five-number summary. Use a histogram or individual-value plot when clusters, gaps, or multimodality could change the interpretation.
  • Overlooking sample size: A box plot of a small group can look similar to one of a large group. Show or report the number of observations when group sizes matter.

Frequently Asked Questions

What is the formula for a box plot? There is no single formula for the whole plot. It uses Q1, the median, Q3, and the data extremes; many versions also use the IQR, found by subtracting Q1 from Q3, and fences 1.5 IQR below Q1 and above Q3 to flag potential outliers.

How do you calculate the IQR for a box plot? Find Q1 and Q3 using a consistent quartile method, then subtract Q1 from Q3. The result is the spread of the middle 50% of the observations.

Do box plot whiskers always show the minimum and maximum? No. Some plots use the minimum and maximum, but a common Tukey box plot ends whiskers at the most extreme values that remain within the 1.5-IQR fences. Check the chart’s definition or settings.

What does a dot beyond a box plot whisker mean? It usually marks an observation outside the selected whisker rule, often beyond a 1.5-IQR fence. It is a potential outlier, not proof that the observation is incorrect.

Why do Excel and another calculator give different quartiles? They may use different quartile or percentile conventions, including inclusive and exclusive methods. Confirm the method and settings in both tools before comparing results.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.