🧮
🧮 Math & statistics

Frequency Table & Histogram Bins Calculator

Results update as you type.

Your numbers

Understanding the frequency table and histogram bins — concept and principle

A frequency table groups numerical data into intervals (bins or classes) and counts how many values fall into each. It is the first step in drawing a histogram and gives a quick picture of where data cluster, how spread out they are and whether the distribution is skewed. Enter your data and either a number of bins or 0 to let Sturges' rule choose.

Frequency table: ten values sorted into five binsSturges’ rule gives 5 bins of width 2.8 from 11 to 25; the counts are 2, 4, 2, 1 and 1.Sort 10 values into 5 bins12151119221518251416111211–13.821415151613.8–16.64181916.6–19.422219.4–22.212522.2–251Sturges: ⌈log₂ 10⌉ + 1 = 4 + 1 = 5 binswidth = (25 − 11) ÷ 5 = 2.8
Five bins of width 2.8 hold 2, 4, 2, 1 and 1 of the ten values.

How it is calculated

  1. Number of bins k: your value, or Sturges' rule k = ⌈log₂ n⌉ + 1, where n is the number of data values.
  2. Bin width: w = (maximum − minimum) ÷ k, so the bins exactly span the data range.
  3. Bin edges: minimum, minimum + w, minimum + 2w, … , maximum.
  4. Counting: a value x goes into bin number ⌊(x − minimum) ÷ w⌋. Each bin includes its lower edge and excludes its upper edge, except the last bin, which also includes the maximum.

The principle

Too few bins hide the shape of the data; too many leave most bins with zero or one value and turn the histogram into noise. Sturges (1926) reasoned that an ideal bell-shaped histogram resembles binomial coefficients: with k bins the counts would follow C(k − 1, i), whose total is 2^(k − 1). Setting 2^(k − 1) ≈ n gives k ≈ log₂ n + 1. The rule grows slowly, so it works well for small, roughly symmetric samples but uses too few bins for large or skewed data sets.

Worked example

  1. Data: 12, 15, 11, 19, 22, 15, 18, 25, 14, 16 (n = 10).
  2. log₂ 10 ≈ 3.32, rounded up to 4, plus 1: k = 5.
  3. Range 25 − 11 = 14, so w = 14 ÷ 5 = 2.8.
  4. Edges: 11, 13.8, 16.6, 19.4, 22.2, 25.
  5. Counts: 11–13.8: 2 (11, 12); 13.8–16.6: 4 (14, 15, 15, 16); 16.6–19.4: 2 (18, 19); 19.4–22.2: 1 (22); 22.2–25: 1 (25).
How Bins changes with Number of bins (0 = Sturges)How Bins changes with Number of bins1234560123456Example: 3Number of bins (0 = Sturges)
Each point is the calculator re-run with only “Number of bins (0 = Sturges)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Number of bins (0 = Sturges)Bins
05
11
22
33
44
55
66

How to read the result

The tallest bin (the modal class) shows where values concentrate, here 13.8 to 16.6. Counts that trail off to the right, as in this example, indicate right skew. Divide each count by n for relative frequencies (here 20%, 40%, 20%, 10%, 10%), which lets you compare data sets of different sizes. Try a few bin counts: a real feature persists across choices, while an artefact of one choice does not.

Common mistakes

Keep in mind: Equal-width bins from the minimum to the maximum give awkward decimal edges and can split natural groupings. For reports, rounded edges (for example 10–14, 14–18) are often clearer. For large samples, rules such as Freedman–Diaconis or Scott usually give better bin widths than Sturges.

Frequently asked questions

Why do two adjacent ranges share an endpoint?

The shared value belongs to the higher bin; only the last bin includes its upper edge.

How many bins should I use for 1,000 values?

Sturges gives ⌈log₂ 1000⌉ + 1 = 11; the square-root rule gives about 32. Choose what shows the shape without excess noise.

Is a frequency table the same as a bar chart?

No. Bar charts show separate categories; histograms show adjacent numeric intervals without gaps.

Sources: Sturges, H. A. (1926). Journal of the American Statistical Association, 21(153), 65–66. · Freedman, D. & Diaconis, P. (1981). Zeitschrift für Wahrscheinlichkeitstheorie und verwandte Gebiete, 57, 453–476.

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →