What a histogram calculator does
A histogram summarizes a set of numeric measurements by dividing the range of the data into a series of adjacent, equal-width intervals called bins, and counting how many values fall into each bin. Plotting those counts as bars reveals the shape of the data: where values cluster, how spread out they are, whether the distribution is symmetric or skewed, and whether there are gaps or outliers. This calculator does the counting for you. You paste a list of numbers, choose how many bins you want (or let it pick a sensible default), and it returns the bin boundaries, the frequency in each bin, and a quick text bar chart.
The formula behind it
Two calculations define an equal-width histogram. First, the number of bins k. If you do not specify it, this tool applies Sturges' rule, one of the oldest and most widely cited defaults:
k = ⌈log₂(n) + 1⌉
where n is the number of data points and ⌈ ⌉ means round up. Second, the bin width, which spans the full data range evenly:
bin width = (maximum − minimum) ÷ k
The bins are then [min, min+w), [min+w, min+2w), and so on. Every bin is half-open (it includes its lower edge but not its upper edge) except the last bin, which is closed at the top so the maximum value is counted. A value x lands in bin index ⌊(x − min) ÷ w⌋.
Why bin count matters more than anything else
The single most important choice in a histogram is the number of bins. Too few bins over-smooth the data and hide real structure — two distinct clusters can merge into one flat block. Too many bins produce a spiky, noisy picture where random sampling wobble looks like signal. There is no universally correct answer, which is why several rules of thumb exist. Sturges' rule (used here by default) tends to under-bin large or skewed datasets, so it is common to also try the square-root rule, k = ⌈√n⌉, or Rice's rule, k = ⌈2·n^(1/3)⌉. The best practice is to try a few values and keep the one that shows the shape most honestly.
Common reference points
- n = 30: Sturges gives ⌈log₂(30) + 1⌉ = ⌈4.907 + 1⌉ = 6 bins; the square-root rule gives ⌈√30⌉ = 6.
- n = 100: Sturges gives ⌈6.644 + 1⌉ = 8 bins; the square-root rule gives 10; Rice's rule gives ⌈2·100^(1/3)⌉ = ⌈9.28⌉ = 10.
- n = 1000: Sturges gives ⌈9.966 + 1⌉ = 11 bins; the square-root rule gives ⌈31.6⌉ = 32 — a big divergence that shows why Sturges under-bins large samples.