How to
How to make a histogram
A histogram shows the shape of a set of numbers: where they bunch up, how far they spread, and whether a few sit far from the rest. The horizontal axis is split into equal ranges called bins, and the height of each bar is how many values fall in that range.
What is a histogram?
A histogram is a chart of the distribution of one numeric variable. The range of the values is cut into bins that touch each other, and each bar stands for how many values fall in its bin, so the chart shows the center, the spread, any skew, outliers and more than one peak. When the bars show counts it is a frequency histogram; show the share of all values instead and you get a relative frequency histogram with exactly the same shape. The term goes back to Karl Pearson, who used it in lectures in 1892. The guide What Is a Histogram? explains how to read one.
- Paste your numbers. Drop in a column from a spreadsheet, or type values separated by commas or spaces. Anything that is not a number is skipped, and the page tells you what was left out.
- Or enter a frequency table. If your data is already counted, switch to A frequency table and give each class a start, an end and a frequency.
- Check the bins. The bins are chosen automatically. The frequency table under Bins shows every range and its count, so you can check the chart against it.
- Adjust if needed. Too few bins hide the shape; too many turn it into noise. Pick another rule, or set the number of bins or the bin width yourself.
- Export. Download PNG or SVG, or copy the image into your document.
How the bins are chosen
By default the number of bins comes from Sturges' rule: take the base 2 logarithm of the number of values, round it up, and add 1. For 24 values that is 6 bins, for 100 values 8 bins. The range of the data is divided by that number and the width is rounded to the nearest 1, 2, 2.5 or 5 times a power of ten, so the edges land on readable numbers. The first bin starts at the largest multiple of the width that is not above your smallest value.
The Freedman-Diaconis rule sets the width to 2 times the interquartile range divided by the cube root of the number of values, then rounds it the same way. It copes better with skewed data and outliers. If the interquartile range is 0, Sturges' rule is used instead. The square root rule uses as many bins as the square root of the count, rounded up. With Set the number of bins the range from the smallest to the largest value is cut into exactly that many equal bins, without rounding.
Which bin does a value on an edge go to?
Each bin includes its left edge and excludes its right edge, so with bins of 5 starting at 55, the value 60 is counted in 60 to under 65, not in 55 to under 60. The last bin includes both edges, so the largest value is always counted.
Tip
If your frequency table has classes of different widths, the bars show frequency density, the frequency divided by the class width. That keeps a wide class from looking bigger than it is: the area of each bar, not its height, stands for the count.
Histogram or bar graph?
Use a histogram for one numeric measurement, like heights, times or scores. Use a bar graph to compare separate categories. For a handful of whole numbers, such as goals per game, a dot plot shows every value, and a box plot is the compact way to compare the spread of several groups.
Questions people ask
How do I make my own histogram?
List the numbers you measured, one value per observation. Split the range into bins of equal width, count how many values land in each bin, and draw a bar for each bin with no gaps between them. This maker does the splitting and counting for you: paste the numbers, check the frequency table it builds, and adjust the bins if the shape looks too jagged or too flat.
Why use a histogram vs. a bar graph?
A histogram shows how one numeric measurement is spread out: where most values sit, how wide the spread is, and whether it leans to one side. The bars touch because the bins are ranges on a continuous scale. A bar graph compares separate categories, like products or countries, so its bars stand apart and could be put in any order.
Can I create a histogram in Excel?
Yes, in Excel 2016 and later. Select the column of numbers and choose Insert, Insert Statistic Chart, Histogram. To change the bins, right-click the horizontal axis, choose Format Axis, and set a bin width or a number of bins. Excel picks its default bins with its own formula, so they can differ from the ones here.