How to Determine How Many Bins for a Histogram


A histogram is a graphical representation of data first introduced by statistician Karl Pearson. A histogram consists of a number of rectangles, or "bins," where the height of the rectangle represents the frequency of observations, and the width of the rectangle represents the quantity being measured. Therefore, the area of the rectangle represents the total number of observations. The histogram is set up like a graph, with numbers on the horizontal axis arranged sequentially so the relative frequency of events can be compared. There is no exact number of bins for a histogram, but there are general rules that can be followed to aid you in developing a histogram.

  • Determine how wide you would like the bin to be. For example, assume that you would like each bin to represent two consecutive values on the horizontal axis (say 1 and 2, or 5 and 6); therefore, the bin width is 2.

  • Subtract the maximum value in the data set by the minimum value in the data set. For example, if the maximum observation is 24 and the minimum is zero, the resulting difference is 24.

  • Divide the difference of the maximum and minimum values by the width of the bins. For the example here, this would mean dividing 24 by 2, which gives 12. This is the number of bins that should be used for your histogram.

Tips & Warnings

  • If the optimal number of bins calculated is a decimal number, round this number up to the nearest integer, regardless of the value. For example, if the optimal bin number was calculated to be 4.15, this would be rounded up to 5.
  • A wide variety of techniques can be used for determining optimal bin size and number. The method outlined here is the most generally applicable; however, the specific technique used may depend on the specific application of the histogram.


  • "Modern Applied Statistics with S, 4th edition"; William N. Venables and Brian D. Ripley; Springer; 2002
  • Photo Credit Goodshoot/Goodshoot/Getty Images
Promoted By Zergnet



You May Also Like

Related Searches

Check It Out

Can You Take Advantage Of Student Loan Forgiveness?

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!