The table, the histogram, and the six rules that disagree about how many bins it should have.
The table, and the six rules that disagree about it
Change it and watch the shape change. That is the point.
Twenty marks. The six rules ask for between 4 and 8 bins — a factor of two.
n = 20, range 12.0000 to 42.0000
6 bins of width 5.0000
The six standard rules suggest between 4 and 8 — a factor of 2.00 on this data.
Square root
5
width 6.000
Sturges
6
width 5.000
Rice
6
width 5.000
Scott
4
width 7.500
Freedman-Diaconis
6
width 5.000
Doane
8
width 3.750
Frequency, relative frequency and cumulative frequency for each bin
Bin
Midpoint
Frequency
Relative
Cumulative
Cumulative %
12.00 – 17.00
14.50
3
15.0%
3
15.0%
17.00 – 22.00
19.50
8
40.0%
11
55.0%
22.00 – 27.00
24.50
5
25.0%
16
80.0%
27.00 – 32.00
29.50
2
10.0%
18
90.0%
32.00 – 37.00
34.50
1
5.0%
19
95.0%
37.00 – 42.00
39.50
1
5.0%
20
100.0%
The six rules ask for 4 to 8 bins — a factor of 2.00. They are not refinements of one another; they optimise different things. Sturges assumes the data is normal and derives the count from a binomial approximation. Scott minimises integrated squared error, also for normal data. Freedman-Diaconis does the same with the IQR instead of the standard deviation, so one outlier cannot widen every bin. Doane adds a term for skewness, which is exactly what Sturges assumes away. The square-root rule has no theory behind it at all and is what spreadsheets default to.
Sturges grows like log₂ n and Freedman-Diaconis like n^(1/3), so they diverge without limit. At n = 100 the gap is modest. At n = 10,000 Sturges asks for 15 bins where the square-root rule asks for 100 and Freedman-Diaconis for 63 — and 15 bins on ten thousand observations smooths away almost every feature the data has. Sturges’ rule was published in 1926 for hand computation and has been criticised for oversmoothing large samples since at least Scott in 1979. It remains a common default.
Bins here are half-open, [lower, upper), except the last. The final bin includes its upper edge, because otherwise the largest value in the dataset falls outside every bin — the classic off-by-one in a hand-built frequency table, and the reason a count column sometimes sums to n − 1. This table’s counts always sum to 20, and the suite checks that across 300 random datasets.
What this tool shows
The bin count is a choice, and the standard rules disagree about it. At n = 10,000 Sturges asks for 15 bins and the square-root rule asks for 100. All six are computed here alongside the table, because a histogram’s shape is an output of that choice rather than a property of the data.
Frequency, relative frequency and both cumulative columns
All six bin-count rules: square root, Sturges, Rice, Scott, Freedman-Diaconis and Doane
A bin count you can override, to see the shape change
The histogram drawn from the table you are looking at
Freedman-Diaconis under all eleven quartile conventions, since the IQR is not one number
Half-open bins with the maximum included, so counts always sum to n
Six bin rules They disagree Counts sum to n Cumulative columns
Updated 12 September 2026 · Works in any browser, no installation
A frequency distribution groups values into intervals and counts how many fall in each. It is the table a histogram is drawn from — and because the intervals are chosen rather than given, two correct frequency distributions of the same data can look like different distributions entirely.
At a glance
Formula shown
Bin width is the range divided by the bin count, and the six rules disagree about that count: √n; ⌈log₂ n⌉ + 1 (Sturges); ⌈2n^(1/3)⌉ (Rice); range ÷ 3.49·s·n^(−1/3) (Scott); range ÷ 2·IQR·n^(−1/3) (Freedman-Diaconis); and 1 + log₂ n + log₂(1 + |g₁|/σ_g₁) (Doane). Relative frequency is each count over n, and the cumulative column is the running total.
Scenario support
Summarising a column of measurements, building a histogram, school and college statistics coursework, checking whether a distribution is skewed or bimodal, and finding the modal class of grouped data.
Educational estimate
Planning support from the values you enter — not professional advice.
Six rules, and they are not refinements of each other
The bin count is the only real decision in a frequency distribution, and the standard rules optimise different things rather than approximating one another.
Sturges assumes normality and a binomial approximation to it. k = ⌈log₂ n⌉ + 1, derived by letting the bin heights be the binomial coefficients of an idealised normal — which fixes n = 2^(k−1). Published in 1926, for hand computation.
Scott minimises integrated squared error, also for normal data. It gives a width, 3.49·s·n^(−1/3), and the count follows. Because it uses the standard deviation, a single outlier widens every bin.
Freedman-Diaconis is Scott with the IQR. 2·IQR·n^(−1/3), so an extreme value cannot inflate the width. It is the most defensible default and it is what this tool uses when you do not override it.
Doane adds a term for skewness, which is exactly what Sturges assumes away. On the right-skewed preset the two part company for that reason.
And the square-root rule has no theory at all. ⌈√n⌉. It is what spreadsheets default to, and at large n it produces far more bins than any of the others.
None of them knows what you are looking for. A rule that oversmooths hides a second mode; one that undersmooths invents structure from noise. Changing the count in the tool and watching the shape move is a better use of thirty seconds than any argument about which rule is correct.
Why Sturges undersmooths large samples
Sturges’ rule is the default in more statistical software than any other, and it is the one with the clearest known failure mode.
It grows like log₂ n, and the others grow like n^(1/3). Logarithms grow very slowly: going from 1,000 observations to 10,000 adds about three bins to Sturges and roughly doubles Freedman- Diaconis.
So the gap widens without limit. At n = 100 the six rules span a factor of 1.4. At n = 2,000, 3.8. At n = 10,000, 6.67 — 15 bins against 100.
Fifteen bins on ten thousand observations is not a histogram. It is a summary with about 670 points per bin, and nearly every feature the data has has been averaged away.
The derivation shows why. Sturges built the rule by matching an idealised normal histogram to binomial coefficients, which forces the relationship n = 2^(k−1). That is a statement about a specific idealised shape, not about how much detail a sample of size n can support.
Scott made this criticism in 1979 and it has been repeated since. The rule survives because it is simple, because it is the default, and because most teaching datasets are small enough for the failure not to show.
The robust rule has a choice of its own
Freedman-Diaconis is recommended because the IQR resists outliers where the standard deviation does not. That is true, and it is not the whole story.
The IQR is not one number. Eleven quartile conventions are in circulation — nine Hyndman-Fan types plus Tukey’s hinges and the Moore-McCabe rule — and they disagree on small samples.
So the bin count inherits that disagreement. On a thirty-point sample the tool reports Freedman-Diaconis under all eleven, and the answers differ. The rule is robust to outliers and not robust to the definition of its own input.
It converges as n grows. The conventions agree in the limit, so on a few hundred observations the spread closes. It is exactly on the small samples where a histogram is hardest to read that the ambiguity is largest.
None of this makes it the wrong default. It is still the best-justified of the six, and being explicit about a second-order choice is better than having an unacknowledged one. The quartile calculator shows all eleven conventions on your own data, and the IQR calculator shows how far apart they land.
The general point applies beyond histograms. Any “robust” method built on quantiles inherits whichever quantile definition its implementation uses, and almost none of them say which. Boxplot whiskers are the most visible case.
Where the edges go, and the off-by-one they cause
Two bins meet at a boundary, and a value landing exactly on it has to go somewhere. The convention matters more than it looks.
This tool uses half-open bins, [lower, upper). A value equal to a boundary goes into the higher bin. That is the standard convention and it makes the bins a genuine partition.
Except the last, which includes its upper edge. Otherwise the maximum of the dataset belongs to no bin at all — and a count column that sums to n − 1 is the classic symptom of a hand-built frequency table.
The choice shows up on rounded data. Marks recorded to the nearest whole number with bin edges at whole numbers put a large share of the values exactly on a boundary, so the two conventions give visibly different histograms. Edges at half-integers avoid it entirely.
Class boundaries and class limits are different things. Limits are what you write in the table — 10 to 19, 20 to 29. Boundaries are where the bins actually meet, 9.5 and 19.5, and they are what the width is computed from. Textbooks distinguish them; most software does not, because it works in boundaries throughout.
The midpoint is what a frequency polygon plots against, and it is what grouped-data formulas use to approximate a mean. Both treat every value in a bin as sitting at its centre, which is an approximation that gets worse as the bins get wider — another cost of undersmoothing.
What each column is for
A full frequency table carries four columns beyond the bin itself, and each answers a different question.
Frequency is the count. The modal class is the bin with the largest one — which is not the same as the mode of the underlying data, and moves when the bins change.
Relative frequency is the proportion. It is what makes two datasets of different sizes comparable, and it is the empirical estimate of the probability of landing in that interval.
Cumulative frequency answers “how many below this”. Plotted against the upper boundaries it gives an ogive, and reading across from n/2 gives the median of grouped data.
Cumulative relative frequency is the empirical CDF at the bin edges. Reading across from 0.25 and 0.75 gives grouped-data quartiles, and it is the quantity a Kolmogorov-Smirnov test compares against a theoretical distribution.
Grouped estimates are approximations, and the tool does not pretend otherwise. A mean computed from midpoints is not the mean of the data; it assumes every value sits at its bin centre. With the raw numbers in hand, the exact mean and median cost nothing and are simply better.
The counts always sum to n. It sounds like it should not need saying, and the verification suite checks it across 300 random datasets precisely because the edge conventions above make it easy to get wrong.
What a histogram can and cannot show
A histogram is the most-read chart in statistics and one of the easiest to over-read, in three specific ways.
Bimodality is the most commonly imagined feature. Two apparent peaks in a small sample are usually noise: with 30 observations in 6 bins, a dip of two counts is entirely ordinary. Change the bin count and see whether the second mode survives.
Skewness is what a histogram shows well. A long tail on one side is robust to the bin choice in a way that fine structure is not, and it is the feature most worth reading off. The skewness calculator puts a number on it.
Outliers are visible but not identified. A bar of height 1 far from the rest says something is out there; it does not say which observation or how far. The outlier calculator names them.
Unequal bin widths distort everything. If the widths vary, the bar area must represent the frequency, not the height — which means plotting frequency density rather than frequency. Software that keeps plotting counts on unequal bins produces a chart that is simply wrong, and this tool uses equal widths throughout for that reason.
For small samples a dot plot or a strip plot is better. Below about 30 observations there is no binning that does not either lose information or invent structure, and showing every point costs nothing.
And a histogram is not a density estimate. It is a piecewise-constant one with an arbitrary origin, which is why shifting the bin edges without changing their width can change the apparent shape. Kernel density estimates exist to remove exactly that dependence.
Sources and methodology
References for the binning rules and their criticisms.
Method. Bins are half-open, [lower, upper), except the last, which includes the maximum — otherwise the largest observation falls outside every bin and the counts sum to n − 1. All six rules are computed on the same data and reported together, with both the width each rule prescribes and the width the table realises after the bin count is rounded up. Freedman-Diaconis is additionally evaluated under all eleven quartile conventions this site implements, because its robustness claim rests on an IQR that is not uniquely defined. The suite asserts that counts always sum to n and relative frequencies to 1 across 300 random datasets, that the rules’ disagreement widens monotonically from n = 100 upward and reaches a factor of 6.67 at n = 10,000, and that Sturges is the smallest of the six at every size above 100. That engine is verified on every change against 75 assertions. The count and the per-case breakdown are published on the formula verification page.
Related calculators
Where this goes next:
Mean, Median and ModeAll three centres marked on your own data, every mode rather than just the first, and the mean-median gap read as a direct measure of skew.
QuartileQ1, Q2 and Q3 by all eleven conventions in common use — Excel, R, Tukey hinges and the TI-84 rule — with a warning when they disagree.
Standard DeviationSample and population standard deviation, plus variance, mean, median, quartiles, z-scores, outliers, and confidence intervals.
SkewnessAll three skewness conventions at once with the standard error beside them, because Excel SKEW runs 18.6% above the textbook formula at n=10 and a normal sample of 30 swings ±0.85 by chance.
PercentileThe value at any percentile and the percentile rank of any value, with all nine standard methods — and the round trip that shows the two directions are not inverses.
Mean Absolute DeviationAll three statistics the acronym MAD names — about the mean, about the median, and the median absolute deviation — plus the ratio to the standard deviation, which is exactly 0.7979 for a normal distribution and so reads as a free shape check.
An educational tool. A histogram’s shape depends on the bin count and the position of the bin edges, both of which are choices; grouped-data estimates of the mean and median treat every value as sitting at its bin midpoint and are approximations.
Published a frequency table that computes all six standard bin-count rules at once, because the bin count is a choice and they disagree about it. Sturges grows like log2 n and Freedman-Diaconis like n^(1/3), so the gap widens without limit: a factor of 1.43 at n = 100 and 6.67 at n = 10,000, where Sturges asks for 15 bins and the square-root rule asks for 100.
Says plainly that Sturges — the default in more software than any other rule — has the weakest justification. It was derived by letting the bin heights be the binomial coefficients of an idealised normal, which fixes n = 2^(k-1), and was published in 1926 for hand computation. Scott criticised it for oversmoothing large samples in 1979.
Reports Freedman-Diaconis under all eleven quartile conventions this site implements. Its whole advantage is that the IQR resists outliers — but the IQR is not one number, so the robust rule inherits an unacknowledged choice of its own, and on a thirty-point sample its bin count moves.
Uses half-open bins with the maximum included in the last one, because otherwise the largest observation falls outside every bin and the counts sum to n - 1 — the classic off-by-one in a hand-built frequency table. The suite checks that counts sum to n and relative frequencies to 1 across 300 random datasets.
Add this calculator to your site
Responsive embed — and private: nothing your visitors type leaves their browser.