Histogram Bin Calculator

Histogram bin counts by three rules.

Math and PercentUpdated 2026-10-131 min read
Histogram Bin Calculator
Sturges
...
Square root...
Rice...

What it does

Histograms live or die on bin count: too few bars bury modes, too many shred signal into noise. Three classic rules turn the observation count into starting counts.

The tool above takes the observation count. It returns Sturges, square root, and Rice bin counts.

The default 100 values gives 8 by Sturges with 10 each by root and Rice. The 30 case reads 6, 6, 7, and 1000 reads 11, 32, 20.

NIST histogram guidance teaches Sturges with root alternatives, and LibreTexts statistics adds Rice for skewed sets. Widths follow by dividing the data range.

Rules start the search; eyes finish it. Empty bins mean fewer, hidden second humps mean more, and categories skip bin math entirely for one bar each.

How to use

  1. Type the observation count.
  2. Read Sturges first.
  3. Read square root beside it.
  4. Read Rice last.
  5. Divide range for width.
  6. Redraw and judge shape.

Formula

Sturges ceil(1 + 3.322 log10 n). Root ceil(root n). Rice ceil(2 n^1/3).
n
Observation count, 5 plus.
Sturges
Classic normal data rule.
Rice
Cube root rule for skew.

NIST/SEMATECH e-Handbook histogram guidance carries Sturges with square root alternatives for bin starts. LibreTexts statistics mirrors Sturges and Rice rules for class counts. Counts here size bins; widths divide the data range by the count.

Worked example

Example: 100 values

Default: 100 observations.

  1. Data: 100 observations.
  2. Sturges: 1 + 3.322 x log10(100) = 7.64, up to 8.
  3. Root: root(100) = 10 bins.
  4. Rice: 2 x cube root(100) = 9.28, up to 10.
  5. Check: 100 / 8 = 12.5 per bin.
  6. Tool shows 8 bins, 10 bins, 10 bins.

Reference table

Checked bin counts
nSturgesRootRice
10081010
30667
1000113220
50788

Limits

  • Counts only, not widths.
  • Rules assume continuous data.
  • Tiny samples wobble.
  • Skew bends every rule.

Common mistakes

  • One rule for all shapes.
  • Binning categories by math.
  • Ignoring empty bins.
  • Forgetting width anchoring.
  • Trusting defaults blindly.

Try it yourself

Quick checks. Answers sit tucked under each question.

30 observations?

Sturges 6, root 6, Rice 7.

1000 observations?

Sturges 11, root 32, Rice 20.

3 observations?

Under 5 starves bin rules: enter 5 plus observations.

Questions

Three rules?

Sturges 1+3.322 log10 n, square root of n, Rice 2n^1/3, each rounded up. Try all three.

Which rule wins?

Sturges for small clean data, root for quick looks, Rice for skewed larger sets.

Bin width from count?

Divide range by bins for width, then anchor edges on round numbers.

Judge the histogram?

Yes, empty bins signal too many; lumpy shapes signal too few. Adjust and redraw.

Categories?

No, rules assume continuous data. Categories need one bar each, not math.

Freedman Diaconis?

Freedman Diaconis uses IQR for width and needs the data itself, not just n.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.