If you want to know how to make a histogram without any software, you need a pencil, a sheet of graph paper and about ten minutes. The work is mostly counting. You sort your numbers, cut their range into equal classes, count how many numbers land in each class, and draw one bar per class with the bars touching. This guide walks through every step on one set of 36 numbers, shows the arithmetic behind three common rules for choosing the classes, and then repeats the job from a frequency table, as percentages, and with a calculator or a spreadsheet.
If you are not sure yet what a histogram is for, or how to read the shape of one, start with our guide What Is a Histogram? and come back.
What You Need Before You Start
A histogram shows one numeric variable. The NIST handbook of statistical methods describes the most common form this way: the range of the data is split into equal-sized bins, called classes, and for each bin you count the number of data points that fall into it. So before you draw anything, check three things.
- Your data is a list of numbers measured on one scale. Heights, times, scores, prices. If your data is a list of categories, such as favorite colors, you need a bar graph instead.
- You have the raw numbers, or a frequency table made from them. A list of averages is not enough.
- You have enough values. OpenStax’s Introductory Statistics gives a rule of thumb: use a histogram when the data set has 100 values or more. It is a rule of thumb, not a law. Our example has 36 values so that you can follow every count, and at that size a dot plot would also work.
The Words Used in This Guide
A class, also called a bin or an interval, is one slice of the number line, such as 5 up to 10. OpenStax uses the three words bars, intervals and classes for the same thing. The class width is how long that slice is. A class boundary is a number where one class ends and the next begins. The frequency of a class is the number of values inside it.
The Sample Data
A teacher asks 36 students how many minutes it takes them to get to school. These are the answers, already written in the order they were collected. The numbers are sample data, made up for this guide.
18, 12, 25, 9, 31, 15, 20, 14, 22, 6, 17, 28, 13, 40, 16, 23, 11, 19, 35, 8, 21, 15, 26, 12, 30, 18, 5, 24, 14, 33, 10, 22, 16, 38, 20, 27
How to Make a Histogram in Eight Steps
Step 1: Sort the Data
Write the numbers again from smallest to largest. Sorting makes every later step faster, and it is the best way to catch a number you copied twice or missed.
5, 6, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 35, 38, 40
Count them: there are still 36.
Step 2: Find the Smallest Value, the Largest Value and the Range
The smallest value is 5 and the largest is 40. The range is the difference: 40 minus 5 is 35 minutes. The classes have to cover those 35 minutes with nothing left out.
Step 3: Decide How Many Classes to Use
This is the only step that calls for judgment. OpenStax notes that many histograms have five to 15 bars, and that the number of bars has to be chosen. For 36 values, somewhere between five and eight classes is a sensible place to look. The next section works through three rules that turn the number of values into a number of classes. For this data they suggest seven, six and five classes. We will use seven.
Step 4: Work Out the Class Width
Divide the range by the number of classes.
35 divided by 7 is 5.
So each class is 5 minutes wide. When the division does not come out even, round to a number that is easy to count in: 1, 2, 5, 10, 20, 25, 50. Six classes would give 35 divided by 6, which is 5.83, and nobody wants class boundaries at 10.83 and 16.67. Round 5.83 to 5 or to 6 and move on.
Step 5: Choose the Starting Point and Write the Boundaries
The first class has to start at or below the smallest value. Here the smallest value is 5 and the class width is 5, so starting at 5 is convenient. Add the class width again and again until you pass the largest value:
5, 10, 15, 20, 25, 30, 35, 40
That is eight boundaries and seven classes.
Now settle one rule before you count: where does a value go when it sits exactly on a boundary? A student who takes 10 minutes could belong to the class 5 to 10 or to the class 10 to 15. OpenStax gives the usual convention: a value is counted in a class if it falls on the left boundary, but not if it falls on the right boundary. So 10 goes into the class that starts at 10. The one exception is the very last boundary. The largest value, 40, has no class to its right, so it stays in the last class.
Step 6: Tally a Frequency Table
Go down the sorted list once and make a tally mark in the right row for each value. Then count the marks.
| Class (minutes) | Values in the class | Frequency |
|---|---|---|
| 5 up to 10 | 5, 6, 8, 9 | 4 |
| 10 up to 15 | 10, 11, 12, 12, 13, 14, 14 | 7 |
| 15 up to 20 | 15, 15, 16, 16, 17, 18, 18, 19 | 8 |
| 20 up to 25 | 20, 20, 21, 22, 22, 23, 24 | 7 |
| 25 up to 30 | 25, 26, 27, 28 | 4 |
| 30 up to 35 | 30, 31, 33 | 3 |
| 35 to 40 | 35, 38, 40 | 3 |
| Total | 36 |
Add the frequencies: 4 + 7 + 8 + 7 + 4 + 3 + 3 is 36, the same as the number of students. If the total does not match, a value was skipped or counted twice. If you would rather not tally by hand, our frequency table maker groups a list of numbers into classes for you.
Step 7: Draw the Axes and the Bars
Take a sheet of graph paper, or print one from our graph paper maker.
- Draw the horizontal axis and mark the eight boundaries on it at equal distances: 5, 10, 15, 20, 25, 30, 35, 40. Give every class the same number of squares, for example two squares each. Label the axis “Minutes to get to school”.
- Draw the vertical axis for the frequency. The tallest bar will be 8, so number the axis from 0 to 8, one square per student. Always start this axis at 0. Label it “Number of students”.
- Draw a bar over each class, from its left boundary to its right boundary, as tall as its frequency: 4, 7, 8, 7, 4, 3, 3.
- Let the bars touch. Each bar ends exactly where the next begins. OpenStax describes a histogram as a set of contiguous, adjoining boxes. The shared sides show that the classes cover the number line with no holes.
- Add a title that says what was measured and for whom.
Step 8: Check Your Work
Before you ink it in, run four checks.
- The frequencies add up to the number of values.
- Every class has the same width.
- There are no gaps between bars, except where a class is truly empty. An empty class is drawn as an empty space of one class width. It is not skipped.
- The boundaries are labeled at the edges of the bars, not in the middle of them.
Here is the finished histogram, drawn by our histogram tool with the same class width and starting point.
Travel time to school for 36 students, in seven classes of 5 minutes starting at 5. The tallest bar is the class 15 up to 20, with 8 students, and the bars get shorter toward the long travel times on the right. Sample data.
Show the data
5, 6, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 35, 38, 40
Compare it with your table: the seven bar heights are 4, 7, 8, 7, 4, 3 and 3, exactly the frequencies you tallied.
Open this histogram with its 36 values
How Many Classes? Three Rules on the Same Data
According to Wikipedia’s article on the histogram, there is no best number of bins, and different bin sizes can reveal different features of the data. The rules below are starting points. Each one turns the number of values, written n, into a suggestion. Here n is 36.
Sturges’ Rule
Sturges’ rule says: take the base-2 logarithm of n, round it up, and add 1.
- The base-2 logarithm of 36 is 5.17.
- Rounded up, that is 6.
- Add 1: 7 classes.
- Class width: 35 divided by 7 is 5.
Wikipedia notes that the rule assumes data that is roughly bell-shaped and that it can do poorly when n is below 30, because it then suggests very few classes.
The Square Root Rule
The square root rule says: take the square root of n and round it up. Wikipedia says this rule is suggested by a number of elementary statistics textbooks.
- The square root of 36 is exactly 6: 6 classes.
- Class width: 35 divided by 6 is 5.83, which you would round to 5 or 6.
The Freedman-Diaconis Rule
This rule gives a class width directly: two times the interquartile range, divided by the cube root of n. The interquartile range, or IQR, is the distance between the first quartile and the third quartile, the points that mark off the lowest quarter and the highest quarter of the data.
- The lower half of the sorted data is the first 18 values. Its median is halfway between the 9th and 10th values, 13 and 14, so the first quartile is 13.5.
- The upper half is the last 18 values. Its median is halfway between 25 and 26, so the third quartile is 25.5.
- The IQR is 25.5 minus 13.5, which is 12.
- The cube root of 36 is 3.30.
- Class width: 2 times 12, divided by 3.30, is 7.27 minutes.
- Number of classes: 35 divided by 7.27 is 4.8, so 5 classes.
Two cautions. First, there is more than one accepted way to compute quartiles, so another book or program may give a slightly different IQR. We used the median of each half, the method OpenStax describes. Second, because the rule uses the IQR, the few very long travel times have little effect on it. Wikipedia describes it as less sensitive to outliers than rules built on the standard deviation.
What the Three Rules Tell You
| Rule | Classes suggested | Raw class width |
|---|---|---|
| Sturges | 7 | 5 |
| Square root | 6 | 5.83 |
| Freedman-Diaconis | 5 | 7.27 |
The three answers are close: five to seven classes, 5 to 7 minutes wide. We chose a width of 5 because multiples of 5 are easy to read on an axis. A width of 6 or 7 would also be a fair histogram of this data. That is normal. In OpenStax’s words, there is more than one correct way to set up a histogram.
What Happens When the Width Is Rounded Up to 10
Automatic tools also round the raw width to a convenient number, and they do not all round the same way. In our histogram tool, the Freedman-Diaconis option rounds 7.27 up to 10 and starts the first class at 0. The result has only four classes.
The same 36 travel times in classes 10 minutes wide. The bars are 4, 15, 11 and 6. You can still see that most students take 10 to 30 minutes, but the peak at 15 to 20 minutes is gone. Sample data.
Show the data
5, 6, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 35, 38, 40
Nothing is wrong with this chart, but it says less. Wide classes smooth away detail.
What Happens When the Width Is Too Small
Go the other way and use classes 2 minutes wide, starting at 4. Now there are 18 classes for 36 students.
The same data in classes 2 minutes wide. No bar is taller than 4, the outline is jagged, and one class, 36 up to 38, is empty. Sample data.
Show the data
5, 6, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 35, 38, 40
With so few values per class, the ups and downs are mostly chance. If your histogram looks like a comb, widen the classes. Our guide to reading histograms has a longer section on how bins change the picture.
Another Correct Answer: Start Half a Unit Lower
Some textbooks avoid the boundary question completely. OpenStax suggests a starting point carried to one more decimal place than the data. For whole numbers whose smallest value is 5, that means starting at 4.5. Then the boundaries are 4.5, 9.5, 14.5 and so on, and no whole number can ever sit on one.
Classes 5 minutes wide starting at 4.5. There are now eight classes, because 40 no longer fits in the seventh: the last two bars are 2 and 1 where the first version had a single bar of 3. Sample data.
Show the data
5, 6, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 35, 38, 40
Both versions are right. Pick one convention, say which one you used, and keep it for every chart you want to compare.
How to Draw a Histogram From a Frequency Table
Often the counting has been done for you, and you are handed a table of classes and frequencies. Then you start at Step 7.
| Books read | Number of students |
|---|---|
| 0 up to 4 | 9 |
| 4 up to 8 | 16 |
| 8 up to 12 | 14 |
| 12 up to 16 | 8 |
| 16 up to 20 | 3 |
- Check the class widths. Every class here is 4 books wide, so the heights can be the frequencies.
- Mark the boundaries 0, 4, 8, 12, 16 and 20 on the horizontal axis.
- Choose the vertical scale. The largest frequency is 16. With one square for every 2 students, the axis needs 8 squares.
- Draw the five bars, touching, with heights 9, 16, 14, 8 and 3.
- Check the total. 9 + 16 + 14 + 8 + 3 is 50 students.
A histogram drawn straight from a frequency table of 50 students. The class 4 up to 8 books is the tallest, with 16 students. Sample data.
Show the data
| From | To | Count |
|---|---|---|
| 0 | 4 | 9 |
| 4 | 8 | 16 |
| 8 | 12 | 14 |
| 12 | 16 | 8 |
| 16 | 20 | 3 |
If the Classes Have Different Widths
Sometimes a table ends with one wide class, such as 16 up to 30. Then height alone misleads, because a wide class collects more values just by being wide. Wikipedia’s article describes the general rule: the area of each bar, not its height, is proportional to the frequency, so the height becomes the frequency divided by the class width. Our tool switches to that scale by itself when the widths in a table differ. For classroom work, the simpler fix is to keep all classes the same width.
A Relative Frequency Histogram: The Same Bars as Percentages
To compare two groups of different sizes, plot percentages. OpenStax defines relative frequency as the frequency divided by the total number of values.
| Class (minutes) | Frequency | Relative frequency |
|---|---|---|
| 5 up to 10 | 4 | 11.1% |
| 10 up to 15 | 7 | 19.4% |
| 15 up to 20 | 8 | 22.2% |
| 20 up to 25 | 7 | 19.4% |
| 25 up to 30 | 4 | 11.1% |
| 30 up to 35 | 3 | 8.3% |
| 35 to 40 | 3 | 8.3% |
Each figure is the frequency divided by 36 and multiplied by 100. The rounded percentages add up to 99.8, not 100, because each one was rounded to one decimal place. That is expected. Do not adjust a bar to force the total.
The travel time histogram with percent on the vertical axis. The shape is identical to the count version. Only the scale changed. Sample data.
Show the data
5, 6, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 30, 31, 33, 35, 38, 40
OpenStax makes the same point: the graph has the same shape whether the vertical axis shows frequency or relative frequency.
Common Mistakes When You Draw a Histogram
Leaving Gaps Between the Bars
Gaps are the mark of a bar graph, where each bar is a separate category. In a histogram the classes share boundaries, so the bars share sides. If you are unsure which chart your data needs, see bar graph vs histogram.
Classes That Overlap or Leave Holes
Classes labeled 5 to 10, 10 to 15 and 15 to 20 leave the reader guessing where 10 belongs. State the rule, as in Step 5, or write the classes as “5 up to 10”. Classes labeled 5 to 9 and 10 to 14 work for whole numbers but leave a hole for a value such as 9.5.
Labels Under the Middle of the Bars
A label centered under a bar turns a class into a category. Put the boundary numbers at the edges of the bars, so the horizontal axis reads like a ruler.
A Vertical Axis That Does Not Start at Zero
The height of a bar is its frequency. If the axis starts at 2, a bar of 4 looks half as tall as a bar of 6 when it is two thirds as tall.
Unequal Widths Drawn by Height
Covered above: if one class is wider than the others, either split it or plot frequency divided by width.
With a Calculator, a Spreadsheet or Online
The steps above are what every program does for you. Knowing them lets you check the result.
On a TI-84
OpenStax gives key steps for the TI-83 and TI-84 family in the same chapter. In outline: press STAT and choose 1:EDIT, type the values into list L1 and, as in OpenStax’s example, the frequency of each value into list L2. Press 2nd and Y= to open the stat plots, choose Plot1, pick the third picture, which is the histogram, and set Xlist to L1 and Freq to L2. In the WINDOW screen, OpenStax sets Xmin and Xmax to the first and last boundaries and Xscl so that it equals the width of one bar. Then press GRAPH, and use TRACE with the arrow keys to examine the bars one by one.
In Google Sheets and Excel
Google’s help page for histogram charts says the chart shows the distribution of a data set across buckets, and that the Customize tab lets you change the bucket size. Bucket size is Google’s name for class width. For Excel, the steps differ by version and method, so they have their own guide: how to create a histogram in Excel.
In Your Browser
Our histogram tool takes a list of numbers or a frequency table. To reproduce a histogram you drew by hand, choose “Set the bin width”, type your class width, and type your starting point in “First bin starts at”. It uses the same boundary rule as this guide: each bin includes its left edge, and the last bin also includes its right edge. It runs in your browser and exports a PNG or an SVG.
Start a histogram from these numbers and replace them with yours
Summary
To make a histogram by hand: sort the data, find the range, choose a number of classes, divide to get the class width and round it, write the boundaries, tally a frequency table, draw touching bars and check that the counts add up. Rules such as Sturges’, the square root rule and Freedman-Diaconis suggest how many classes to try, and they often disagree a little, which is fine. For other ways to show a set of numbers, see our overview of types of graphs and charts.
Questions people ask
How to draw a histogram step by step?
Sort the numbers and find the smallest and largest. Divide the range by the number of classes you want to get a class width, and round it to a convenient number. Count how many values fall in each class, then draw one bar per class, as tall as its count, with the bars touching.
How do I create a histogram on graph paper?
Use one square per unit of frequency on the vertical axis and a fixed number of squares per class on the horizontal axis. Mark the class boundaries on the grid lines, then shade a column for each class up to its count. Neighboring columns share a side, so no gap is left between them.
How do you calculate a histogram?
There are two calculations. First the class width: the range of the data divided by the number of classes, rounded to a convenient number. Then the frequency of each class: the number of values that fall inside it. For a percent histogram, divide each frequency by the total number of values and multiply by 100.
How to turn a bar graph into a histogram?
Usually you cannot do it by reformatting. A bar graph compares separate categories, and a histogram needs one numeric variable grouped into classes. If your bars already stand for equal number ranges in order, remove the gaps and label the boundaries. Otherwise go back to the raw numbers and group them into classes first.
Can I make a histogram in sheet?
Yes, if the question is about Google Sheets. Google's help page describes a histogram chart that shows how a data set is spread across buckets, and the Customize tab has a Histogram section where you change the bucket size. The arithmetic is the same as on paper: the bucket size is your class width.
How do you draw a histogram from a frequency table?
Skip the sorting and tallying, because the table has already done them. Put the class boundaries on the horizontal axis, choose a vertical scale that reaches the largest frequency, and draw one bar per row of the table. Check first that every class has the same width, or the heights will mislead.