A histogram is a chart that shows how a single continuous variable is distributed across its range of values. It is one of the first things a researcher should look at after collecting or importing data, before running any statistical test, because it shows shape, spread, and anomalies that a mean and standard deviation alone can conceal.
What a histogram shows
A histogram divides the range of a continuous variable into consecutive, non-overlapping intervals called bins, counts how many observations fall into each bin, and draws a bar for each bin whose height (or area, for unequal bin widths) represents that count or frequency. Reading a histogram left to right shows where values cluster, where they thin out, and whether the data forms one peak, several peaks, or no clear peak at all.
Because a histogram summarizes an entire distribution in one image, it is the standard first step in exploratory data analysis: before you compute a mean, run a t-test, or fit a regression, plotting a histogram tells you whether those downstream steps are even appropriate for the data you have.
Histogram vs. bar chart
This is the single most common point of confusion, and it matters for more than terminology — mixing the two up leads to genuinely wrong charts.
- What’s on the x-axis. A histogram’s x-axis is a continuous numeric variable (age, response time, blood pressure) that has been binned into ranges. A bar chart’s x-axis is a set of discrete categories (treatment group, country, yes/no) that have no inherent numeric order or continuity.
- Whether the bars touch. Histogram bars are drawn touching, because the bins are adjacent, contiguous slices of a continuous scale — there is no gap between “10–19” and “20–29”. Bar chart bars are drawn with gaps between them, because the categories are discrete and the space between them is meaningless.
- Whether order matters. Reordering a histogram’s bins would misrepresent the variable; reordering a bar chart’s categories (e.g., alphabetically vs. by frequency) is a legitimate design choice.
A related but different chart to keep straight: this guide covers histograms for a single continuous variable. If you are instead summarizing counts across categories, a bar chart — not a histogram — is the right choice.
How to build a histogram: choosing bin width
The number and width of bins is the single choice that most affects what a histogram appears to show. Too few, wide bins can smooth away real structure — a genuinely bimodal distribution can look like one smooth hump. Too many, narrow bins can make the same data look noisy or artificially spiky, with gaps caused by nothing more than sample size. Because the same underlying data can be made to look smooth, bimodal, or ragged purely by changing bin width, bin choice is a substantive analytic decision, not a cosmetic one, and it should be reported alongside the figure (see “Reporting standards” below).
Several conventional rules exist for choosing a starting bin count or width. None is universally “correct” — they are starting points, and it is good practice to try more than one and confirm the conclusion is not an artifact of a single bin choice:
- Square-root choice. Number of bins ≈ the square root of the sample size (n). Simple and common as a default in many software packages — the same n that also drives a study’s power analysis and sample-size planning.
- Sturges’ rule. Number of bins ≈ 1 + log₂(n). Works well for roughly normal, moderately sized datasets, but tends to under-bin (over-smooth) larger datasets or skewed distributions.
- Freedman–Diaconis rule. Bin width = 2 × IQR(x) / n^(1/3), where IQR is the interquartile range. Because it scales with spread rather than just sample size, it generally performs better than Sturges’ rule on skewed data or data with outliers.
Whichever rule a package defaults to, treat it as a starting point: adjust bin width and re-plot until the histogram shows the structure that’s actually in the data, rather than an artifact of the default.
Axis conventions
The x-axis should show the variable’s actual scale in consistent, equal-width units unless you have an explicit and disclosed reason to vary bin width. The y-axis typically shows either raw frequency (count of observations per bin) or relative frequency/density (proportion of the total, useful for comparing histograms built from samples of different sizes). Label both axes with units, and start the y-axis at zero — a histogram’s bar heights are only meaningfully comparable when the baseline is zero, the same principle that applies to bar charts generally.
Reading distribution shape
Once a histogram is built with a reasonable bin choice, its shape is informative in its own right:
- Symmetric / approximately normal. A single central peak with roughly mirror-image tails on either side. This is the shape many parametric statistical tests assume the underlying data (or model residuals) will approximate.
- Right-skewed (positively skewed). A peak toward the lower end of the scale with a long tail stretching to the right — common for variables like income, wait times, or hospital length of stay, where a hard lower bound (often zero) exists but no hard upper bound does.
- Left-skewed (negatively skewed). The mirror image: a long tail stretching to the left, with most values clustered toward the upper end — common near a ceiling effect, such as scores on an easy test.
- Bimodal or multimodal. Two or more distinct peaks, often a sign that the sample actually contains two or more subpopulations that should be examined separately (for example, a mixed-sex measurement, or data pooled across two study sites with different baseline conditions) rather than analyzed as one homogeneous group.
- Uniform. Roughly equal frequency across the whole range, with no dominant peak — less common in natural measurements, more common in some simulated or randomization-check data.
For the full breakdown of what right- and left-skew mean for choosing between the mean and median, see CASRAI’s guide to skewness (left-skewed vs. right-skewed distributions).
A mean and standard deviation collapse a distribution into two numbers, and those two numbers are the same whether the underlying data is a clean symmetric distribution or a bimodal distribution made of two very different subgroups. This is why plotting the histogram first, before reporting summary statistics, is standard practice: it is often the only step that reveals the average is not actually representative of any single observation in the dataset. For the full set of central tendency, dispersion, and shape statistics a histogram is checking against, see CASRAI’s guide to descriptive statistics.
Why researchers use histograms
- Checking assumptions before parametric tests. Many common tests (t-tests, ANOVA, linear regression) assume approximately normal data or normally distributed residuals. A histogram is a fast, intuitive first check, though for a formal judgment a Q-Q plot or a formal normality test is more precise — see the comparison below. For the full set of checks — Q-Q plots, Shapiro-Wilk, skewness/kurtosis — and what to do when the assumption doesn’t hold, see CASRAI’s guide to normality of distribution. This kind of visual normality check applies to continuous outcomes; for a categorical outcome, the relevant assumption to check instead is the expected-cell-count rule covered in CASRAI’s chi-square test guide.
- Spotting outliers and data-entry errors. An implausible value — an age of 200, a negative measurement where none should exist — often shows up as an isolated bar far from the rest of the distribution, long before it would be obvious scanning a spreadsheet.
- Checking residuals. After fitting a regression model, plotting a histogram of the residuals is a standard diagnostic for whether the model’s error term is behaving as the model assumes.
- Sanity-checking before summarizing. Before reporting a mean, median, or any single summary statistic, a histogram is the fastest way to confirm that statistic is actually a reasonable description of the data.
- Checking before trusting a correlation. Anscombe’s quartet shows that very different distributions can produce identical correlation coefficients; plotting histograms of both variables, alongside a scatterplot, is a standard sanity check before interpreting a correlation coefficient.
Histogram vs. density plot, box plot, violin plot, and Q-Q plot
A histogram is one of several standard ways to visualize a distribution, and each has a different strength:
- Density plot (kernel density estimate). A smoothed curve estimating the same underlying distribution a histogram approximates with bars. It avoids the “blocky,” bin-width-dependent look of a histogram and makes shape comparisons across groups easier, but the smoothing itself involves a choice (bandwidth) that has the same kind of influence on apparent shape that bin width has for a histogram — and it can visually imply values exist (e.g., slightly below a true floor of zero) that the raw data never contains.
- Box plot. Summarizes a distribution using five numbers (minimum, first quartile, median, third quartile, maximum, plus flagged outliers) rather than the full shape. Box plots are far more compact and excellent for comparing many groups side by side, but they cannot show bimodality — a box plot of a clearly bimodal dataset looks identical to a box plot of a unimodal one with the same median and quartiles.
- Violin plot. Combines a box plot’s group-comparison layout with a density plot’s shape information, mirrored on both sides of an axis. It solves the box plot’s bimodality-blindness while keeping multiple groups comparable, at the cost of being less immediately intuitive to a general audience than a histogram.
- Q-Q (quantile-quantile) plot. Plots the sample’s quantiles against the quantiles a theoretical distribution (usually normal) would produce; points falling on a straight diagonal line indicate a good match. For the specific, common question “is this data close enough to normal to justify a parametric test,” a Q-Q plot is a more precise diagnostic than a histogram, because it is far more sensitive to deviations in the tails — exactly where normality violations most affect many parametric tests — that can be hard to see by eye in a binned histogram.
- Cumulative distribution function (CDF). Rather than showing counts within bins, a CDF plots the running proportion of the data at or below each value — no binning decisions required, and exact percentiles can be read directly off the curve. See CASRAI’s guide to the cumulative distribution function (CDF) for how it relates to a histogram and when to prefer one over the other.
In practice these are complementary, not competing: a histogram for a fast, intuitive first look and for communicating shape to a general audience; a Q-Q plot when the specific question is normality; and box or violin plots when the goal is comparing many groups compactly.
Making a histogram: R, Python, SPSS, and Excel
R
Base R’s built-in function plots a histogram directly from a numeric vector: hist(x), with bin count adjustable via the breaks argument, e.g. hist(x, breaks = 20). For publication-quality or layered plots, the tidyverse package ggplot2 uses ggplot(data, aes(x = variable)) + geom_histogram(binwidth = 5), where binwidth (or, alternatively, bins) sets the bin size explicitly rather than relying on a default.
Python
With matplotlib: plt.hist(x, bins=20). With seaborn, which layers more statistical defaults on top of matplotlib: sns.histplot(data=df, x="variable", bins=20), which also supports overlaying a kernel density estimate directly with kde=True.
SPSS
In SPSS, histograms are available through Graphs → Chart Builder, selecting the histogram chart type and dragging the variable of interest onto the x-axis, or as an option directly within many analysis dialogs (for example, the Explore and Frequencies procedures both offer a histogram as an output option, which is a convenient way to get one alongside descriptive statistics for the same variable in a single step).
Excel
Modern Excel (Excel 2016 and later) has a built-in Histogram chart type under Insert → Charts → Insert Statistic Chart → Histogram, which bins the selected data automatically and lets you override bin width via the axis options. Older versions require the Analysis ToolPak add-in’s Histogram tool, or a manual approach using FREQUENCY() array formulas against a chosen set of bin boundaries.
Reporting standards
A histogram presented in a manuscript, thesis, or report should meet a few baseline standards for it to be interpretable and trustworthy:
- Label both axes with units. A reader should never have to guess what the x-axis measures or what the y-axis represents (count vs. proportion vs. density).
- Show n. The sample size the histogram is built from should be stated in the caption or on the figure — the same shape looks far more or less convincing depending on whether it summarizes 20 observations or 20,000.
- Disclose bin width or bin count. Because bin choice materially affects apparent shape (see above), state how bins were chosen (a specific rule, or a specific width/count) so a reader or reviewer can judge whether the shape shown is robust to that choice.
- Use accessible color and contrast. If bars are colored to distinguish groups or highlight a subset, ensure sufficient contrast and avoid relying on red/green alone, so the figure remains interpretable for colorblind readers and in grayscale print.
- Do not truncate or rescale axes to exaggerate an effect. Starting the y-axis above zero, or stretching/compressing an axis to make a difference look larger or smaller than it is, is a figure-manipulation problem, not a stylistic choice — the same integrity principle that applies to image and data figures generally. See CASRAI’s coverage of image manipulation for how this fits into the broader research-integrity standards journals and institutions apply to figures.
Frequently asked questions
Is a histogram the same as a bar chart?
No. A histogram plots a single continuous variable binned into ranges, with bars drawn touching because the bins are contiguous. A bar chart plots discrete categories, with gaps between bars because the categories have no inherent continuity.
How many bins should a histogram have?
There is no single correct answer — common starting rules are the square-root choice, Sturges’ rule, and the Freedman–Diaconis rule, but all are defaults, not laws. Try more than one bin width and check whether the conclusion you’re drawing from the shape holds up across them.
What does a bimodal histogram mean?
Two or more peaks usually indicate the sample contains two or more distinct subpopulations (different groups, sites, or conditions pooled together) rather than one homogeneous population, and it’s often worth investigating whether those subgroups should be analyzed separately.
Should I use a histogram or a Q-Q plot to check normality?
A Q-Q plot is the more precise tool for specifically judging normality, because it is more sensitive to deviations in the tails of a distribution than a histogram is. Use a histogram for a fast, intuitive first look and for communicating shape to a general audience; use a Q-Q plot (or a formal normality test) when the analytic decision actually depends on how close to normal the data is.
Can a histogram be misleading?
Yes — most commonly through bin width chosen (deliberately or not) to smooth away or exaggerate structure, or through a truncated/rescaled axis that visually exaggerates a difference. Both are avoidable by disclosing bin width/count and always starting the y-axis at zero.







