Calculate how many histogram bins to use from your sample size with Sturges’ rule, k = 1 + log2(n), plus class width from the data range.
- All Statistics Calculators
- Sigma Level Calculator
- Outlier Calculator
- Ppk (Process Performance Index) Calculator
Sturges’ Rule Formula
Sturges’ rule estimates how many equal-width bins to use when building a histogram from a sample. It is a quick, widely used starting point because it needs only the sample size and produces a simple whole-number recommendation.
Here, ceil means round up to a whole number. An exact common-logarithm version divides by log10(2). The rounded coefficient 3.322 is only approximate and can change rounding near a bin boundary:
- k = recommended number of histogram bins
- n = total number of observations in the data set
- Round up is selected by default; nearest and round down are alternative integer conventions.
How to Use the Sturges’ Rule Calculator
- Count the total number of observations in your data set.
- Choose histogram bins mode, enter the positive whole sample size, and select the rounding convention.
- Read the bin estimate and comparisons. Optionally enter both data endpoints to estimate class width; leave both blank for bin counts alone.
- Use that value as a starting point, then adjust if the graph looks too coarse or too compressed.
Every data point counts toward the sample size, including repeated values. If the same number appears several times, each occurrence is still a separate observation. For reverse solving, enter the desired bin count; the returned sample-size range always uses round up.
Example Calculation
If a sample contains 2,000 observations, the recommended number of bins is:
So a histogram with 12 bins is the standard Sturges recommendation for that sample size.
Quick Reference Table
| Observations | Recommended Bins |
|---|---|
| 10 | 5 |
| 25 | 6 |
| 50 | 7 |
| 100 | 8 |
| 250 | 9 |
| 500 | 10 |
| 1,000 | 11 |
| 2,000 | 12 |
Finding Bin Width After You Know the Number of Bins
Once you know how many bins to use, you can estimate a uniform bin width from the data range:
This is useful when you want actual class intervals rather than just a bin count. Subtract the minimum value from the maximum value, then divide by the recommended number of bins.
When Sturges’ Rule Is Most Useful
- Creating a fast first-pass histogram
- Small to medium-sized samples
- Introductory statistics and classroom exercises
- Data sets that are roughly unimodal and not extremely skewed
- Situations where only the sample size is known
Practical Interpretation
- The rule grows slowly as the sample grows because it is based on a logarithm.
- When the sample size roughly doubles, the recommendation increases by about one bin.
- This makes Sturges’ rule conservative, which often gives clean, readable histograms.
- Because it is conservative, it may smooth over important detail in very large data sets.
Limitations of Sturges’ Rule
- It uses only sample size and ignores spread, skewness, and outliers.
- It can recommend too few bins for very large samples.
- It may hide multiple peaks or long tails in complex distributions.
- It is best treated as a starting point rather than a strict requirement.
Common Questions
Do I count unique values only?
No. Count every observation in the sample, even if several observations have the same value.
Can I use Sturges’ rule for decimals?
Yes. The rule depends on the number of observations, not on whether the values are whole numbers or decimals.
Is the recommended number of bins always optimal?
No. It is a rule of thumb meant to provide a sensible default. If the histogram looks too flat or too compressed, you can increase or decrease the number of bins.
What kind of graph is this rule used for?
It is primarily used for histograms and grouped frequency distributions built from quantitative data.
