Skip to main content
Calcimator

Histogram Bin Calculator

Calculate the optimal number of histogram bins and bin width using Sturges, Scott, Freedman-Diaconis, Square Root, and Rice rules based on your dataset properties.

Inputs

Results

Optimal Number of Bins

8

Bin Width

6.25

Method UsedSturges' Rule
Sturges Bins8
Scott Bins6
Freedman-Diaconis Bins8
Square Root Bins10
Rice Bins10
How to Use This Calculator
  1. Enter Number of Data Points (n), Data Range, and Primary Method.
  2. Set Sturges, Scott, and Freedman-Diaconis.
  3. Adjust Interquartile Range (IQR) as needed.
  4. Review Optimal Number of Bins and Bin Width.
  5. Use Method Used and Sturges Bins to inform your decision.

What each input means

Number of Data Points (n)
Total number of observations in your dataset.
Data Range
The range of your data (maximum value minus minimum value).
Primary Method
Sturges: good for normal data. Scott: accounts for spread. Freedman-Diaconis: robust to outliers (uses IQR).
Interquartile Range (IQR)
IQR = Q3 - Q1. Required for Scott's and Freedman-Diaconis methods. Used to estimate standard deviation.

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    4 parameters
    Number of Data Points (n) = 100, Data Range = 50, Primary Method = 1, Interquartile Range (IQR) = 15 = 4 input(s) provided
  2. Calculate Optimal Number of Bins
    8 = 8
  3. Calculate Bin Width
    Bin Width
    6.25 = 6.25
  4. Calculate Method Used
    Sturges' Rule = Sturges' Rule
  5. Calculate Sturges Bins
    Sturges Bins
    8 = 8

Engine last updated . Checked against 2 independently-derived tests how we verify calculators.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Manufacturing, Industrial & Coatings.