Enter the total number of observations (sample size) in the data set into the calculator to determine the recommended number of bins using Sturges’ rule.

Sturges’ Rule Calculator

Enter exactly 1 value to calculate the other variable.

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.

k = \left\lceil \log_2(n) + 1 \right\rceil

An equivalent version uses common logarithms:

k = \left\lceil 1 + 3.322 \log_{10}(n) \right\rceil
  • k = recommended number of histogram bins
  • n = total number of observations in the data set
  • The result is rounded up to the next whole number

How to Use the Sturges’ Rule Calculator

  1. Count the total number of observations in your data set.
  2. Enter that sample size into the calculator.
  3. Read the recommended number of bins for your histogram.
  4. 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.

Example Calculation

If a sample contains 2,000 observations, the recommended number of bins is:

k = \left\lceil \log_2(2000) + 1 \right\rceil
k = \left\lceil 10.9658 + 1 \right\rceil = \left\lceil 11.9658 \right\rceil = 12

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:

w = \frac{x_{\max} - x_{\min}}{k}

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.