Class Width Calculator
This class width calculator gives the width you need for a frequency table or histogram. Example: data running from 12 to 98 in 8 classes have an exact width of 10.75, rounded up to 11.
Example: Number of classes: Choose the number of classes · Smallest value (minimum) 12 · Largest value (maximum) 98 · Number of classes k 8 · Round up to a multiple of 1 → Result: Class width = 11 (range 86, 8 classes, exact 10.75). Source: Wikipedia – Histogram (number of bins and width). Updated: .
How it is calculated
The class width is the distance between the lower and upper limit of a class in a frequency table or histogram. It follows from the range of the data and the number of classes you want.
Formula and steps
First compute the range: maximum minus minimum. Dividing it by the number of classes k gives the exact width. Because class limits should be tidy, the result is rounded up to a multiple of a step, to the next whole number for integer data. You either choose the number of classes yourself or estimate it with Sturges’ rule, k = ⌈1 + log₂ n⌉.
Worked example
The data run from 12 to 98, so the range is 86. For 8 classes 86 / 8 = 10.75, rounded up to 11. The classes are 12 up to 23, 23 up to 34 and so on to 89 up to 100; the last limit 12 + 8 · 11 = 100 lies above the maximum 98. With n = 100 values Sturges gives k = ⌈7.64⌉ = 8, so the same grouping.
- Always rounding up keeps the maximum inside the last class; rounding down could lose values at the top.
- Too many narrow classes show only noise, too few wide ones hide the shape of the distribution.
Frequently asked questions
How do you calculate class width?
Divide the range (maximum − minimum) by the number of classes and round up to a convenient number. For 12 to 98 in 8 classes: 86 / 8 = 10.75, so 11.
How many classes should I use?
As a rule of thumb use Sturges’ k = ⌈1 + log₂ n⌉. For n = 100 that is 8 classes. Check the histogram to see whether the shape of the distribution stays visible.
Why is the class width rounded up?
So the largest data point still falls into the last class. With the exact width 10.75 the limits would be awkward, and rounding error could cut off the maximum.
Sources and legal basis
As of: · Editorial policy
Related tools
- Standard deviation calculatorStandard deviation calculator for a list or frequency table: switch between sample (s) and population (σ), see every step in a table, plus a box plot.
- Quartile CalculatorQuartile calculator: enter your numbers to get Q1, median, Q3, the interquartile range and outliers, with four methods and the full working shown.
- Stem and Leaf Plot GeneratorStem and leaf plot generator: enter your numbers and get stems and leaves sorted automatically, with a key, split stems and the median.
- Midrange CalculatorMidrange calculator for a list of numbers: (minimum + maximum) / 2, with range, mean and median shown for comparison and the working step by step.
- Sample size calculatorSample size calculator for surveys: required number of respondents from confidence level, margin of error and proportion – with finite population correction.
- Average CalculatorAverage calculator: mean, median, mode and weighted average of your numbers with working and frequency table – plus the value needed for a target average.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Earthquake magnitude calculator: how much stronger?Earthquake magnitude calculator: compare two magnitudes – energy ratio (about 32 times per step, 1000 times for two) and amplitude ratio (10 times per step).
- Newton law of cooling calculatorNewton law of cooling calculator: find the temperature after a time, the time to reach a target temperature or the cooling constant – with a worked example.