Every histogram and frequency table starts with one decision: how wide should each class be? The arithmetic is one division — but with a rounding rule that exists for a reason, and limits that must actually contain the data. This class width calculator takes your minimum, maximum and desired number of classes, computes the width, rounds it the correct way, and lays out every class limit so the table can be built without a gap swallowing your largest value.
The Formula and the Rounding Rule
Class width = (maximum − minimum) ÷ number of classes, always rounded UP to a convenient number. The page's example: data from 12 to 98 in 8 classes gives (98 − 12) ÷ 8 = 86 ÷ 8 = 10.75 → width 11. The rounding direction is the content: round down (or merely to nearest) and the classes can fail to cover the range — 8 classes of width 10 span only 80 of the 86 needed, orphaning the largest values. Rounding up guarantees coverage, at the small price of a last class that extends a little past the maximum (here to 99), which harms nothing. "Convenient" does quiet work too: a raw width of 10.75 becomes 11, a raw 0.47 might become 0.5 — prefer widths a reader can count in (1, 2, 5, 10 and their decimal kin).
Reading the Class Limits
With width 11 starting at the minimum 12, the classes run 12–22, 23–33, 34–44, 45–55, 56–66, 67–77, 78–88, 89–99 for whole-number data — each lower limit one past the previous upper, no gaps, no overlaps, every value owning exactly one class. For continuous or decimal data the same limits are read as half-open intervals: 12 up to but not including 23, and so on, which is the convention histograms use internally. Textbooks distinguish class limits (the printed numbers) from class boundaries (the true dividing lines, halfway between an upper limit and the next lower — 22.5 here); boundaries are what you would use for a histogram of continuous data so the bars touch.
How Many Classes? The Judgement Call
The calculator takes the class count as given because it is a judgement, but the judgement has guides. Too few classes (say 3) crush the distribution's shape into a shrug; too many (say 40 for 50 points) leave a picket fence of gaps and noise. Rules of thumb: Sturges suggests k ≈ 1 + log₂(n) (about 7 for n = 100, 11 for n = 1,000); the square-root rule suggests k ≈ √n; most teaching texts land between 5 and 20 classes for typical data. Let purpose arbitrate: a table for spotting skew wants more classes; a table for a report's first page wants fewer, wider, rounder ones.
Equal Widths, and When to Break the Rule
Everything here assumes equal-width classes, which is the right default: equal widths make bar heights directly comparable as frequencies, so the histogram tells the truth at a glance. Unequal widths (income bands are the classic — 0–10k, 10–25k, 25–50k, 50–100k, 100k+) are legitimate for skewed data but demand density scaling (height = frequency ÷ width) or the wide classes visually shout. Exam syllabi and most software defaults assume equal width; deviate deliberately, label clearly, and never mix the two conventions in one graphic.
Midpoints: The Statistic Each Class Keeps
Once data is grouped, the class midpoint — (lower + upper) ÷ 2 — becomes its working surrogate: grouped means and standard deviations are computed by pretending every value sits at its class midpoint. For 12–22 the midpoint is 17. The approximation is why grouped-data statistics are estimates, and why the width choice matters statistically and not just cosmetically: narrower classes keep midpoints closer to the true values they replace. Keep the raw data whenever you can; grouping is a display technology that moonlights as arithmetic only when the originals are lost.
Common Mistakes
Rounding the width down and losing the top values. Starting classes at a round number below the minimum without noticing the shift (starting at 10 instead of 12 is a legitimate choice — but then there are 9 classes of width 11 to reach 98, not 8; recount). Overlapping limits (12–23, 23–34) that give boundary values two homes. Inconsistent widths mid-table. And counting classes from a textbook's example instead of from your own range — the width formula wants your maximum and minimum, outliers included, which is why one freak value can stretch every class: consider whether it belongs before you let it set the scale.
Related Tools
The data-display bench continues in the Statistics Calculators hub — the Effect Size Calculator compares groups once they are summarised, and the Decile Calculator cuts the same data into tens.
Frequently Asked Questions
How do you calculate class width?
Class width = (maximum − minimum) ÷ number of classes, rounded up. For data from 12 to 98 with 8 classes: (98 − 12) ÷ 8 = 10.75, which rounds up to a width of 11.
Why must the class width be rounded up?
So the classes cover the whole range. Eight classes of width 10 span only 80, less than the range of 86 — the largest values would fall outside the table. Rounding up to 11 spans 88 and covers everything.
How many classes should a frequency table have?
Usually 5 to 20. Sturges' rule suggests about 1 + log2(n) — roughly 7 classes for 100 values, 11 for 1,000. Fewer classes hide the shape; too many fragment it into noise.
What are class limits for width 11 starting at 12?
12–22, 23–33, 34–44, 45–55, 56–66, 67–77, 78–88 and 89–99 for whole-number data. Each class begins one unit after the previous ends, so no value can fall between classes or into two.
What is a class midpoint?
The centre of a class: (lower limit + upper limit) ÷ 2 — 17 for 12–22. Grouped-data means and standard deviations treat every value in a class as if it were the midpoint.
Should classes always be the same width?
By default, yes — equal widths make frequencies directly comparable. Unequal widths (common for income) need density scaling on graphs, or wide classes mislead the eye by their area.