How Many Bins for a Histogram? Sturges' Rule, Square Root, and Freedman-Diaconis

October 21, 2026

A histogram groups data into bins and shows how many values fall in each, revealing the shape of a distribution: whether it is symmetric, skewed, or has multiple peaks. The choice of bin width matters a lot. With too few bins, you hide structure; with too many, you see noise. Several rules of thumb give starting points, and you should adjust by looking at the picture.

The most famous is Sturges' rule: number of bins = 1 + log₂(n), where n is the number of observations. For 100 data points, log₂(100) = 6.64, so about 8 bins. For 1,000 points, about 11 bins. The rule works well for roughly normal data and modest sample sizes but tends to give too few bins for large datasets or skewed data.

Skip the math and get your answer instantly:

Open the Average Calculator →

Common Rules of Thumb

Square-root rule: bins ≈ √n, which gives 10 for 100 points and 32 for 1,000. Sturges: 1 + log₂(n). Rice rule: 2 × n^(1/3), giving 9 for 100 points and 20 for 1,000. Scott's rule uses bin width h = 3.49 × s × n^(−1/3), where s is the standard deviation. Freedman-Diaconis uses h = 2 × IQR × n^(−1/3), which is robust to outliers because it depends on the interquartile range. Once you have the bin width, the number of bins is the data range divided by the width, rounded up.

Sample size nSturges (1 + log2 n)Square rootRice (2 x n^(1/3))
30666
1008109
500102316
1,000113220
10,0001510043

A Worked Example

Suppose you have 200 exam scores ranging from 38 to 98, with an IQR of 16. Freedman-Diaconis: h = 2 × 16 × 200^(−1/3) = 32 ÷ 5.85 = 5.5 points. The number of bins = (98 − 38) ÷ 5.5 = 10.9, so use 11 bins. In practice, you would round the bin width to 5 points, giving 12 bins from 35 to 100, for easily readable bin edges. Sturges would have suggested 1 + log₂(200) = 8.6, about 9 bins with a width of about 6.7, which is harder to read. Round bin edges at natural values (multiples of 5 or 10) make the chart easier to interpret.

How Bin Choice Changes the Story

The same dataset can look unimodal with wide bins and bimodal with narrow ones. A dataset with two groups, such as heights of men and women, shows two humps only if the bins are narrow enough to resolve them. With too narrow bins, random ups and downs appear as spurious peaks. Try several bin widths, and look for features that persist across them. Also consider where the bins start: shifting the starting point can change the shape slightly, especially with small samples. Kernel density plots avoid binning but have their own smoothing parameter.

Practical Tips

Start with a rule of thumb, then adjust. Use natural bin boundaries. Keep bins equal in width unless you have a good reason; if unequal, plot density rather than counts. Label axes, specify whether bins include the lower or upper boundary, and consider showing the count. For small samples (under 30), a dot plot or stem-and-leaf plot may serve better. Most software (Excel, R, Python) has built-in rules; check which one is the default so you know what you are looking at.

Frequently Asked Questions

What is Sturges' rule?

Number of bins = 1 + log base 2 of n, a quick rule for histogram bins.

How many bins for 100 data points?

About 8 with Sturges' rule or 10 with the square-root rule.

Which rule is best for skewed data?

Freedman-Diaconis, which uses the IQR and is robust to outliers, often works well.

What happens with too many bins?

The histogram looks noisy and shows spurious peaks.

Should bins have equal width?

Usually yes, for easier interpretation.