Histogram Hub

How Many Bins Should a Histogram Have?

July 7, 2026

Start with the data, not a formula

Bin count is a judgment call, not a fixed answer. Too few bins and you flatten the shape into a blob. Too many and every bar is noise. The right number is the one that shows the real shape of your data without inventing detail that isn't there.

So let's not open a calculator yet. Let's take one real, slightly messy dataset and actually look at what different bin counts do to it. If you want the full rule reference, that lives on how to choose bins. This post is about making the call.

The dataset

Here are 30 daily order counts from a small shop. Nothing clean about it. Here's the shape of it in numbers:

StatValue
Count (n)30
Min12
Max58
Range46
Mean27.97
Median24.5
Standard deviation11.47
IQR13.75

One number matters more than the rest here. The mean (27.97) sits above the median (24.5). That gap is the tell: the data is right-skewed. Most days cluster low, and a few busy days stretch the top end out. That long thin tail on the right is exactly the thing a bad bin count will hide from you. If skew is new to you, the right-skewed histogram page walks through what it looks like and why it happens.

What each rule says to do

There are five common rules for picking a bin count. Each one takes the same 30 values and hands back a number. Here's what they give for this dataset:

RuleFormulaBins for this data
Sturgesk = ceil(log2 n) + 16
Freedman-Diaconiswidth = 2 x IQR x n^(-1/3)6
Scottwidth = 3.49 x s x n^(-1/3)4
Ricek = ceil(2 x n^(1/3))7
Square-rootk = ceil(sqrt n)6

Four of the five land in a tight band. Sturges, Freedman-Diaconis, and square-root all say 6. Rice says 7. Scott is the odd one out at 4.

That spread is the whole point. The rules mostly agree, and where one disagrees, it's worth asking why.

Why Scott under-bins here

Scott and Freedman-Diaconis are close cousins. Both set a bin width and let the data decide the count. The difference is what they measure spread with. Scott uses the standard deviation. Freedman-Diaconis uses the IQR.

That swap matters for skewed data. Standard deviation gets pulled around by those few busy days in the tail. A couple of high values inflate it, the bin width grows, and you end up with wider, fewer bins. That's how Scott lands at 4.

Four bins on right-skewed data is a problem. Watch what happens to the tail.

With Scott (4 bins, each 11.5 wide), the bar counts run:

13, 10, 4, 3

The tail is basically gone. The last two bins hold small counts and the drop-off looks gentle. You'd never guess there's a real skew here.

Now Sturges (6 bins, each 7.67 wide):

7, 11, 5, 3, 2, 2

Same data, and now you can see it. A clear peak early, then a steady step down across four more bins. That's a right tail you can actually read. The busy days show up as their own thin bars instead of getting swallowed into a fat one.

The IQR is more stubborn than the standard deviation. It only cares about the middle 50% of the data, so a few extreme days don't blow it up. That's why Freedman-Diaconis holds at 6 while Scott collapses to 4. For skewed data, that stubbornness is a feature, and it's why Freedman-Diaconis is the safer default when you don't want to babysit every dataset.

So what should you actually do

For this dataset, pick 6. Sturges, Freedman-Diaconis, and square-root all agree on it, and at 6 bins the right tail reads clearly instead of getting flattened. Rice at 7 would also be fine. Scott's 4 is the one to skip, because it hides the shape you most need to see.

The general habit worth keeping:, Start with Freedman-Diaconis as your default, since IQR handles skew and outliers without complaint., If the rules disagree, look at the tails. The bin count that keeps a real tail visible beats the one that smooths it away., Try two or three counts near the suggested number and eyeball them. The data will tell you when a bar is real signal versus a gap that shouldn't be there.

The fastest way to do that last step is to just try it. Paste your numbers into the histogram maker, nudge the bin count up and down, and watch the shape settle. If you'd rather see the raw counts per bin first, the frequency distribution table tool lays them out before you plot anything.

There's no single correct bin count. There's the one that shows your data honestly, and for skewed data like this, that means not letting Scott talk you into four.