Box Plot Calculator
Enter raw data in the Raw Data tab first, then come here to see the full step-by-step solution.
No data yet — enter values in the Raw Data tab first.
What Is a Box Plot (Box-and-Whisker Plot)?
A box plot, also called a box-and-whisker plot, is a standardized way to display numerical data based on its five-number summary: the minimum, first quartile (Q1), median (Q2), third quartile (Q3), and maximum. The central rectangle covers the middle 50% of the data (the interquartile range, or IQR), with a line inside marking the median. Lines called whiskers extend outward from the box to the most extreme non-outlier values, and individual data points beyond those whiskers are plotted separately as outliers.
John Tukey introduced the basic form of this chart in his 1977 book Exploratory Data Analysis, and its compact design has made it a standard tool across statistics, data science, healthcare research, manufacturing quality control, and finance. A single box plot packs the five most important distributional facts — center, spread, skewness, range, and unusual values — into a space that would otherwise require a full histogram. When you need to compare multiple groups, box plots placed side by side are especially efficient: you can scan for differences in median and variability at a glance without reading a table of numbers.
Visual Anatomy of a Box Plot
Every component of a box plot has a precise statistical definition. This table maps each visual element to what it measures.
| Component | Statistical Definition | Visual Representation | What It Measures |
|---|---|---|---|
| Box Body | Q1 to Q3 | Central rectangle | Middle 50% of the data (IQR) |
| Median Line (Q2) | 50th percentile | Solid line inside the box | Measure of central tendency |
| Lower Whisker | Smallest data point ≥ LIF (Q1 − 1.5×IQR) | Line extending left/down from Q1 | Dispersion of lower 25% (non-outlier) |
| Upper Whisker | Largest data point ≤ UIF (Q3 + 1.5×IQR) | Line extending right/up from Q3 | Dispersion of upper 25% (non-outlier) |
| Outlier Points | Values < LIF or > UIF | Individual dots beyond whiskers | Extreme values or measurement anomalies |
| Extreme Outliers | Values < LOF or > UOF (±3×IQR) | Differently styled dots (asterisks) | Possible data errors or rare events |
How to Make a Box Plot — Step by Step
To draw a box plot: sort your data, find the five-number summary, calculate the IQR, compute the Tukey fences, set the whisker endpoints, and plot any outliers individually. This six-step process is exactly what the calculator above performs on your data.
Arrange all values from smallest to largest. For example, the dataset {28, 12, 33, 15, 22, 58, 18, 25, 30, 19, 31, 24} becomes {12, 15, 18, 19, 22, 24, 25, 28, 30, 31, 33, 58}.
For n = 12 (even), average the 6th and 7th values: (24 + 25) / 2 = 24.5. For an odd n, the median is the middle value directly.
Using the exclusive method: split into lower half {12, 15, 18, 19, 22, 24} and upper half {25, 28, 30, 31, 33, 58}. Q1 = (18 + 19) / 2 = 18.5. Q3 = (30 + 31) / 2 = 30.5.
IQR = Q3 − Q1 = 30.5 − 18.5 = 12.0. Lower Inner Fence = 18.5 − 1.5(12) = 0.5. Upper Inner Fence = 30.5 + 1.5(12) = 48.5.
Lower whisker: smallest value ≥ 0.5, which is 12. Upper whisker: largest value ≤ 48.5, which is 33. The value 58 exceeds 48.5, so it becomes an outlier point.
Draw the box from Q1 = 18.5 to Q3 = 30.5 with a line at the median 24.5. Extend whiskers left to 12 and right to 33. Plot a separate dot at 58 to represent the outlier.
Worked result: Min = 12, Q1 = 18.5, Median = 24.5, Q3 = 30.5, Max = 58. IQR = 12.0. Outlier: 58. LIF = 0.5, UIF = 48.5. Lower whisker ends at 12, upper whisker ends at 33.
Mathematical Formulas
The complete set of equations behind a box plot, following Tukey's original method.
Median (Q2)
If n is odd: x[(n+1)/2]
If n is even: (x[n/2] + x[n/2+1]) / 2
Interquartile Range
IQR = Q3 − Q1
Tukey Inner Fences
LIF = Q1 − 1.5 × IQR
UIF = Q3 + 1.5 × IQR
Tukey Outer Fences
LOF = Q1 − 3.0 × IQR
UOF = Q3 + 3.0 × IQR
Whisker Endpoints
Lower: min(x ≥ LIF)
Upper: max(x ≤ UIF)
Notch (95% CI for Median)
Median ± 1.58 × IQR / √n
Two methods exist for computing Q1 and Q3. The exclusive method (Moore & McCabe; Excel PERCENTILE.EXC) excludes the median from each half. The inclusive method (Tukey; Excel PERCENTILE.INC) includes the median. With an even n, both methods give identical results. The difference appears with odd-sized datasets and can shift Q1 and Q3 by a small amount. Both are mathematically valid; the exclusive method is more common in introductory statistics courses.
Interpreting Distribution Shape and Skewness
The position of the median line inside the box and the relative lengths of the whiskers tell you about the skewness of the underlying distribution without needing the full data.
| Visual Profile | Median Position | Whisker Length Ratio | Skewness Interpretation |
|---|---|---|---|
| Symmetric | Centered inside box | Equal length on both sides | Normal / Unskewed (Mean ≈ Median) |
| Right-Skewed (Positive) | Closer to Q1 (lower edge) | Right/upper whisker is longer | Long tail toward higher values (Mean > Median) |
| Left-Skewed (Negative) | Closer to Q3 (upper edge) | Left/lower whisker is longer | Long tail toward lower values (Mean < Median) |
| High Variability | Any position | Wide box, long whiskers | Large IQR; high spread relative to group size |
Box plots do not reveal bimodality (two peaks in a distribution). If you suspect your data has two distinct clusters, pair the box plot with a histogram to see the full frequency picture. The two charts are genuinely complementary: box plots win for multi-group comparison, histograms win for showing the exact shape of one dataset.
📊 Worked Example with Outlier Detection
Data is already in order. n = 12 (even), so Median = (6th + 7th) / 2 = (24 + 25) / 2 = 24.5.
Lower half: {12, 15, 18, 19, 22, 24} → Q1 = (18 + 19) / 2 = 18.5. Upper half: {25, 28, 30, 31, 33, 58} → Q3 = (30 + 31) / 2 = 30.5.
IQR = 30.5 − 18.5 = 12.0.
LIF = 18.5 − 1.5(12) = 0.5. UIF = 30.5 + 1.5(12) = 48.5. The value 58 > 48.5, so it is a mild outlier. No values below 0.5, so no lower outliers.
Lower whisker: smallest value ≥ 0.5 = 12. Upper whisker: largest value ≤ 48.5 = 33.
The median (24.5) sits close to Q1, and the upper whisker is longer than the lower one, indicating mild right-skewness. The outlier at 58 pulls the mean above the median.
Five-Number Summary: Min = 12, Q1 = 18.5, Median = 24.5, Q3 = 30.5, Max = 58. IQR = 12.0. Outlier: 58. You can reproduce this exactly in the Raw Data tab above using the "Worked Example" button.
Box Plot vs. Histogram — When to Use Each
Both plots summarize numerical data, but they answer different questions. Knowing which to reach for saves time in real analysis.
| Feature | Box Plot | Histogram |
|---|---|---|
| Best for | Comparing multiple groups side by side | Showing the exact shape of one distribution |
| Outlier detection | Explicit — plotted as separate points | Only visible as isolated bars |
| Bimodality | Cannot detect two peaks | Clearly shows multiple peaks |
| Skewness | Visible from whisker asymmetry | Visible from bar pattern |
| Sample size sensitivity | Works well even with small n (≥ 5) | Requires larger n for meaningful bin counts |
| Space efficiency | Very compact — 6 groups fit in one figure | Needs more space per group |
🏭 Real-World Applications
Quality Assurance and Manufacturing
Production engineers use box plots to compare part dimensions across machines or shifts. If the IQR box for Machine A is much wider than for Machine B, Machine A has greater variability — a sign of process inconsistency that needs investigation. Outlier points represent individual units that fell outside specification. This analysis is central to Six Sigma and Statistical Process Control methodologies. For the related dispersion metric, see the standard deviation calculator.
Healthcare and Clinical Trials
Clinical researchers routinely use box plots to compare patient outcomes across treatment groups. A box plot of recovery times for a treatment group vs. a control group immediately shows whether the medians differ, whether variability differs, and whether extreme responders (outliers) skew the picture. This approach is discussed in detail in hypothesis testing in clinical trials. For comparing group medians formally, you would follow the box plot inspection with a test such as the t-test or Mann-Whitney U test.
Finance and Real Estate
Analysts compare house price distributions across neighborhoods, or investment return distributions across asset classes, using box plots. A neighborhood where the upper whisker is very long but the box is compact suggests a small number of luxury properties pulling up the average well above the median price that most buyers will encounter. The outlier detection guide covers this application in more depth.
Exploratory Data Analysis (EDA)
Data scientists typically produce box plots in the early stages of any project to get a fast overview of each numerical feature. An extreme outlier in a feature could represent a data entry error, a sensor malfunction, or a genuinely rare event — all require different handling. For a broader treatment of this workflow, see the exploratory data analysis guide. Box plots also pair naturally with the outlier handling guide to decide whether to remove, cap, or transform outlier values.
Code Implementation Guide
Python (matplotlib & seaborn)
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
data = [12, 15, 18, 19, 22, 24, 25, 28, 30, 31, 33, 58]
# Seaborn box plot with individual point overlay
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
# Standard box plot
sns.boxplot(x=data, ax=axes[0], color='skyblue', showmeans=True,
meanprops={'marker':'D','markerfacecolor':'red'})
axes[0].set_title('Box Plot (Seaborn)')
axes[0].set_xlabel('Values')
# Strip chart overlay (jitter)
sns.boxplot(x=data, ax=axes[1], color='lightcoral', flierprops={'marker':'o'})
sns.stripplot(x=data, ax=axes[1], color='navy', alpha=0.6, jitter=True, size=5)
axes[1].set_title('Box + Jitter Strip Chart')
# Print the five-number summary
q1, median, q3 = np.percentile(data, [25, 50, 75])
iqr = q3 - q1
print(f"Min={min(data)}, Q1={q1}, Median={median}, Q3={q3}, Max={max(data)}")
print(f"IQR={iqr}, LIF={q1 - 1.5*iqr:.2f}, UIF={q3 + 1.5*iqr:.2f}")
plt.tight_layout()
plt.show()
R Language
data <- c(12, 15, 18, 19, 22, 24, 25, 28, 30, 31, 33, 58)
# Base R box plot with horizontal orientation
stats <- boxplot(data,
main = "Box Plot Example",
horizontal = TRUE,
col = "lightblue",
xlab = "Values")
# Five-number summary and outliers
print(fivenum(data)) # Min, Q1, Median, Q3, Max (Tukey hinges)
print(boxplot.stats(data)$out) # Outliers detected by 1.5xIQR rule
# ggplot2 version (for publication quality)
# library(ggplot2)
# df <- data.frame(value = data, group = "Dataset")
# ggplot(df, aes(x = group, y = value)) +
# geom_boxplot(fill = "steelblue", outlier.colour = "red", outlier.size = 3) +
# coord_flip() +
# theme_minimal()
Microsoft Excel / Google Sheets
In Excel 2016 and later: select your data range, then choose Insert → Insert Statistic Chart → Box and Whisker. Excel uses the exclusive quartile method (PERCENTILE.EXC) by default. For the underlying formulas:
Q1:
=QUARTILE.EXC(A1:A12, 1) → 18.5Median:
=MEDIAN(A1:A12) → 24.5Q3:
=QUARTILE.EXC(A1:A12, 3) → 30.5IQR:
=QUARTILE.EXC(A1:A12,3) - QUARTILE.EXC(A1:A12,1) → 12Lower Inner Fence:
=QUARTILE.EXC(A1:A12,1) - 1.5*(QUARTILE.EXC(A1:A12,3)-QUARTILE.EXC(A1:A12,1)) → 0.5
Related Calculators and Guides on Statistics Fundamentals
Box plots connect to descriptive statistics, outlier detection, and distributional analysis. These tools and guides work alongside the box plot calculator.
Sources and Further Reading
Authority sources cited in this guide:
- Tukey, J.W. (1977). Exploratory Data Analysis. Addison-Wesley. (Original introduction of the box-and-whisker plot.)
- National Institute of Standards and Technology (NIST). Engineering Statistics Handbook — Box Plot. itl.nist.gov
- Penn State STAT 200. Elementary Statistics — Five Number Summaries and Boxplots. online.stat.psu.edu
- OpenStax. Introductory Statistics, Chapter 2: Descriptive Statistics. openstax.org
- Moore, D.S. & McCabe, G.P. (2006). Introduction to the Practice of Statistics, 5th ed. W.H. Freeman. (Exclusive quartile method.)
Frequently Asked Questions
Outliers are identified using Tukey's rule: any data point more than 1.5×IQR below Q1 or above Q3 is classified as a mild outlier and plotted individually as a dot beyond the whisker. Points more than 3.0×IQR outside the box are extreme outliers, sometimes shown with a different symbol such as an asterisk. The method is distribution-free, meaning it works on any dataset without assuming normality — which is one reason box plots remain useful for skewed or heavy-tailed data.
A histogram shows the full frequency distribution of a single dataset — you can see bimodality (two humps), the precise shape of the tails, and the bin-by-bin count. A box plot compresses the same data into five numbers and makes outliers explicit. The box plot's real advantage shows when you need to compare multiple groups: placing six box plots side by side is practical; placing six histograms side by side is cluttered. For a single dataset where you want to see the exact shape, use a histogram. For comparing groups or reporting distributional summaries, use a box plot.
Whiskers in a standard Tukey box plot extend only to the most extreme data points that still fall within the inner fences (Q1 − 1.5×IQR and Q3 + 1.5×IQR). If the actual minimum or maximum is beyond these fences, it gets plotted as an outlier point instead. This design choice prevents extreme values from stretching the whiskers so far that the box itself becomes too small to read. Some software packages offer a "range" box plot where whiskers do extend to the absolute min and max — in that case there are no outlier dots by definition.
Notches display a roughly 95% confidence interval around the median, calculated as Median ± 1.58×IQR/√n. When the notches of two side-by-side box plots do not overlap, it is reasonable evidence (at about 95% confidence) that the true medians of the underlying populations differ. Notched box plots are particularly common in scientific publications and R's ggplot2 library. The confidence level is approximate and relies on large-sample assumptions, so non-overlapping notches are suggestive rather than conclusive.
At least 4 to 5 values are needed to calculate all five components of the five-number summary with distinct Q1 and Q3 values. In practice, box plots become genuinely informative with 20 or more observations, and most textbooks recommend at least this many before reading distributional shape from the plot. With very small samples (n < 10), the individual data points themselves carry more information than the box plot summary, so a strip chart or dot plot is often a better choice.
When n is odd, the two methods disagree on how to handle the median value. The exclusive method (Moore & McCabe; Excel QUARTILE.EXC) excludes the median from both halves when finding Q1 and Q3. The inclusive method (Tukey; Excel QUARTILE.INC) includes the median in each half. This produces slightly different Q1 and Q3 values and therefore a slightly different IQR and fence placement. When n is even, the two methods give identical results because there is no single middle value. Both are valid — just choose one method and apply it consistently within a project.
A median line closer to Q1 (the lower edge) means the lower 50% of the data is compressed into a narrow range while the upper 50% spreads over a wider range — this indicates right-skewness (a positive tail). A median closer to Q3 indicates left-skewness. In a perfectly symmetric distribution, the median splits the box exactly in half. This visual check is faster than computing a skewness coefficient and is one of the key reasons analysts use box plots early in exploratory data analysis.