InfyCalculator
📊

Sturges’ Rule Histogram Bins Calculator

Find how many histogram bins to use with Sturges’ rule, the square-root rule and Rice’s rule, plus the class width for your data range.

Number of observations (n)
Smallest value
Largest value
Loading calculator…

How it works

k = ⌈1 + log₂(n)⌉ · width = range ÷ k

Sturges’ rule assumes roughly bell-shaped data and grows slowly with sample size, so it tends to under-bin large or skewed datasets. The square-root and Rice rules give more bins for big n. All three are starting points — nudge the width to a round number and check the histogram looks sensible.

Worked example

n = 120 → 1 + log₂(120) = 7.9 → 8 bins. With a range of 86, each bin is about 10.75 wide (round to 11).

Frequently asked questions

Why round the width up?

Rounding down would leave the top value outside the last bin. Rounding the width up (or to a tidy number) keeps every point covered.

Which rule should I use?

Sturges for small, near-normal samples; Rice or square-root for larger samples; Freedman–Diaconis when the data are skewed with outliers.

Related calculators

For education — check assumptions (sample size, distribution) before using statistics in real decisions.