Histogram Hub

How to Make a Histogram

The steps

Making a histogram comes down to five steps, whether you do it by hand or let a tool do it:

  1. Find the range. Subtract the smallest value from the largest. For the ages example on this site the range is 40.
  2. Pick the number of bins. A common rule is Sturges, ceil(log2 n) + 1. For 20 values that gives 6 bins.
  3. Find the bin width. Divide the range by the number of bins and round to something tidy.
  4. Count the frequencies. Tally how many values fall in each bin. Values on a boundary go into the next bin up.
  5. Draw the bars. One bar per bin, heights equal to the counts, bars touching.

The fast way

The histogram maker does all five steps as you type. Paste your numbers, pick a binning method, and it computes the range, bins, counts, and bars instantly, plus the mean, median, and standard deviation. You can then download a PNG or SVG.

By hand or in a spreadsheet

If you are learning, doing one histogram by hand is worth it so the steps stick. In a spreadsheet you can bucket values with a formula and chart the counts, but you still have to choose the bins yourself, and most default charts hide that choice. Reading the how to choose the number of bins guide will save you from the two classic mistakes: too few bins hiding real detail, and too many inventing fake spikes.

Frequently asked questions

What are the steps to make a histogram?
Find the range, choose the number of bins, compute the bin width, count how many values fall in each bin, then draw one touching bar per bin with height equal to its count.
How do I choose the bin width?
Divide the range (max minus min) by the number of bins, then round to a convenient number. A tidy width like 5 or 10 is easier to read than an awkward decimal.
Which value goes in a boundary bin?
By the usual convention a value that lands exactly on a boundary goes into the higher bin. The one exception is the maximum value, which goes into the final bin so it is not left out.