Frequency Table Calculator
Separate the numbers with spaces, commas, semicolons or new lines. Use a point for decimals (3.5). A comma separates numbers, so type 1500, not 1,500. Negatives work. Up to 5,000 values.
Leave them empty to use Sturges' rule. If you type a width, the number of classes follows from it.
Mean (grouped):
Median (grouped):
Mode (grouped):
Calculation:
Type or paste your numbers and this calculator builds the frequency table, draws the histogram and finds the mean, median and mode of the grouped data, with every step shown. If you already have the table, skip the raw data and enter the classes and their frequencies directly.
Below the calculator you will find how to use it, what each column means, the formulas, four worked examples, a table for Sturges' rule and answers to common questions.
How to use the frequency table calculator
Step 1: Choose I have a list of values or I have classes and frequencies.
Step 2: Paste the values separated by spaces, commas, semicolons or new lines. With classes, write one class per line: lower limit, upper limit and frequency.
Step 3: Leave the class settings empty to let Sturges' rule decide, or type a number of classes, a class width or a starting point. The + and - buttons add or remove one class.
Step 4: Read the table, the histogram, and the mean, median and mode. The Calculation box shows every step with your numbers. Turn on the frequency polygon if you need it.
How numbers are read. Type decimals with a point: 3.5. A comma separates numbers, so type one thousand five hundred as 1500, not 1,500. Negative numbers work. The calculator accepts up to 5,000 values and 40 classes, and shows results with a decimal point, no thousands separator and rounded to 4 decimals (values below 0.01 keep 4 significant digits). Class limits and midpoints are shown in full.
What each column of the frequency table means
| Symbol | Name | How it is found |
|---|---|---|
| Class | Interval | [a, b): includes a and leaves out b. The last class also includes b. |
| x | Class midpoint (class mark) | The middle of the class: (a + b) ÷ 2. |
| f | Absolute frequency | How many values fall in the class. |
| F | Cumulative frequency | The running total of f up to and including that class. |
| fr | Relative frequency | f ÷ n, a number from 0 to 1. |
| Fr | Cumulative relative frequency | F ÷ n. It ends at 1. |
| % | Percent | fr × 100. It ends at 100. |
| f · x | Frequency times midpoint | Used for the mean. Its total is Σ(f · x). |
The class convention used here
Every class is written [a, b): it includes its lower limit a and leaves out its upper limit b. So a value of 70 goes in [70, 80), not in [60, 70). The last class is closed, [a, b], so the largest value always has a place. The median and mode formulas below use the lower limit L of the class, which fits this convention.
Some books write whole-number classes as 10-19, 20-29. In the classes option, type 10 19 and 20 29: because there is a gap of 1 between them, the calculator moves each limit half a unit outward and uses the class boundaries 9.5 to 19.5, 19.5 to 29.5 and so on.
Mean, median and mode of grouped data
Once the data is grouped, each value is replaced by its class midpoint x. The formulas use n (the total frequency), the class midpoints and the cumulative frequencies:
| Mean: x̄ = Σ(f · x) ÷ n |
| Median: Med = L + ((n ÷ 2 - F) ÷ f) · c |
| Mode: Mo = L + (d1 ÷ (d1 + d2)) · c |
In the median formula, L is the lower limit of the median class (the first class whose cumulative frequency reaches n ÷ 2), F is the cumulative frequency of the class before it, f is the frequency of the median class and c is its width. In the mode formula, L and c belong to the modal class (the highest frequency), d1 is its frequency minus the one before it, and d2 is its frequency minus the one after it. If the modal class is the first or the last one, the missing neighbor counts as 0. If two classes tie for the highest frequency, the formulas give the limit they share when the classes are next to each other, and two separate modes when they are not. If three or more classes in a row tie, the mode is the middle of that stretch.
When you do not choose the number of classes or the width, Sturges' rule is used: k = 1 + log2(n), rounded up. Then the calculator picks a round width (1, 2, 2.5 or 5 times a power of 10) that brings the number of classes as close to k as it can, so the count can land a little above or below k. If your teacher wants exactly k classes, type that number in Number of classes: the calculator looks for a convenient width, at least range ÷ k, that gives exactly that many classes.
Frequency table examples with answers
Example 1: heights of 20 students (raw data)
Heights in centimeters: 150, 152, 153, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 166, 168, 169, 172, 175, 178, 183. We let the calculator choose the classes.
| Class | Midpoint (x) | f | F | fr | Fr | % |
|---|---|---|---|---|---|---|
| [150, 155) | 152.5 | 3 | 3 | 0.15 | 0.15 | 15 |
| [155, 160) | 157.5 | 6 | 9 | 0.3 | 0.45 | 30 |
| [160, 165) | 162.5 | 4 | 13 | 0.2 | 0.65 | 20 |
| [165, 170) | 167.5 | 3 | 16 | 0.15 | 0.8 | 15 |
| [170, 175) | 172.5 | 1 | 17 | 0.05 | 0.85 | 5 |
| [175, 180) | 177.5 | 2 | 19 | 0.1 | 0.95 | 10 |
| [180, 185] | 182.5 | 1 | 20 | 0.05 | 1 | 5 |
| Total | 20 | 1 | 100 |
Data: n = 20, the smallest value is 150, the largest is 183 and the range is 33.
Sturges' rule: k = 1 + log2(20), which is about 5.3219. Rounded up, that is a target of 6 classes.
Class width: range ÷ classes = 33 ÷ 6, which is 5.5. The calculator picks a round width (1, 2, 2.5 or 5 times a power of 10) that brings the number of classes as close to 6 as it can: c = 5. The first class starts at 150, which gives 7 classes.
Σ(f · x) = 152.5 · 3 + 157.5 · 6 + 162.5 · 4 + 167.5 · 3 + 172.5 · 1 + 177.5 · 2 + 182.5 · 1, which is 3265.
Mean: x̄ = Σ(f · x) ÷ n = 3265 ÷ 20, which is 163.25.
Median: n ÷ 2 = 20 ÷ 2 = 10. The cumulative frequency F first reaches 10 or more in the class [160, 165), so that is the median class.
In that class, L = 160, the F before it is 9, f = 4 and c = 5.
Med = L + ((n ÷ 2 - F) ÷ f) · c = 160 + ((10 - 9) ÷ 4) · 5, which is 161.25.
Mode: the highest frequency is 6, in the class [155, 160).
d1 = 3 (this class minus the one before it) and d2 = 2 (this class minus the one after it).
Mo = L + (d1 ÷ (d1 + d2)) · c = 155 + (3 ÷ (3 + 2)) · 5, which is 158.
For comparison, the mean of the ungrouped data is 162.65 and its median is 160.5. The grouped values are estimates, because grouping loses the exact position of each value.
The grouped mean (163.25) is close to the mean of the ungrouped data (162.65) but not equal to it: that gap is the price of grouping.
Example 2: classes and frequencies only
A table gives the exam scores of 40 students, grouped into classes. In the classes and frequencies option you type one class per line:
40 50 550 60 860 70 1570 80 980 90 3
| Class | Midpoint (x) | f | F | fr | Fr | % |
|---|---|---|---|---|---|---|
| [40, 50) | 45 | 5 | 5 | 0.125 | 0.125 | 12.5 |
| [50, 60) | 55 | 8 | 13 | 0.2 | 0.325 | 20 |
| [60, 70) | 65 | 15 | 28 | 0.375 | 0.7 | 37.5 |
| [70, 80) | 75 | 9 | 37 | 0.225 | 0.925 | 22.5 |
| [80, 90] | 85 | 3 | 40 | 0.075 | 1 | 7.5 |
| Total | 40 | 1 | 100 |
Σ(f · x) = 45 · 5 + 55 · 8 + 65 · 15 + 75 · 9 + 85 · 3, which is 2570.
Mean: x̄ = Σ(f · x) ÷ n = 2570 ÷ 40, which is 64.25.
Median: n ÷ 2 = 40 ÷ 2 = 20. The cumulative frequency F first reaches 20 or more in the class [60, 70), so that is the median class.
In that class, L = 60, the F before it is 13, f = 15 and c = 10.
Med = L + ((n ÷ 2 - F) ÷ f) · c = 60 + ((20 - 13) ÷ 15) · 10, which is about 64.6667.
Mode: the highest frequency is 15, in the class [60, 70).
d1 = 7 (this class minus the one before it) and d2 = 6 (this class minus the one after it).
Mo = L + (d1 ÷ (d1 + d2)) · c = 60 + (7 ÷ (7 + 6)) · 10, which is about 65.3846.
No ungrouped data was needed: the table is enough.
Example 3: the modal class is the first one
Waiting times in minutes, given as classes and frequencies:
0 5 125 10 910 15 615 20 320 25 1
| Class | Midpoint (x) | f | F | fr | Fr | % |
|---|---|---|---|---|---|---|
| [0, 5) | 2.5 | 12 | 12 | 0.3871 | 0.3871 | 38.71 |
| [5, 10) | 7.5 | 9 | 21 | 0.2903 | 0.6774 | 29.03 |
| [10, 15) | 12.5 | 6 | 27 | 0.1935 | 0.871 | 19.35 |
| [15, 20) | 17.5 | 3 | 30 | 0.0968 | 0.9677 | 9.68 |
| [20, 25] | 22.5 | 1 | 31 | 0.0323 | 1 | 3.23 |
| Total | 31 | 1 | 100 |
Σ(f · x) = 2.5 · 12 + 7.5 · 9 + 12.5 · 6 + 17.5 · 3 + 22.5 · 1, which is 247.5.
Mean: x̄ = Σ(f · x) ÷ n = 247.5 ÷ 31, which is about 7.9839.
Median: n ÷ 2 = 31 ÷ 2 = 15.5. The cumulative frequency F first reaches 15.5 or more in the class [5, 10), so that is the median class.
In that class, L = 5, the F before it is 12, f = 9 and c = 5.
Med = L + ((n ÷ 2 - F) ÷ f) · c = 5 + ((15.5 - 12) ÷ 9) · 5, which is about 6.9444.
Mode: the highest frequency is 12, in the class [0, 5).
There is no class before it, so that frequency counts as 0.
d1 = 12 (this class minus the one before it) and d2 = 3 (this class minus the one after it).
Mo = L + (d1 ÷ (d1 + d2)) · c = 0 + (12 ÷ (12 + 3)) · 5, which is 4.
Because there is no class before it, its frequency counts as 0 and d1 equals the frequency of the class (12). The mode (4) leans toward the neighboring class with more data, which is the next one (9 values), so it lands near the upper end of the class.
Example 4: limits written as 10-19 and 20-29
Ages of 30 people, with classes written the way many books do:
10 19 620 29 1130 39 840 49 5
| Class | Midpoint (x) | f | F | fr | Fr | % |
|---|---|---|---|---|---|---|
| [9.5, 19.5) | 14.5 | 6 | 6 | 0.2 | 0.2 | 20 |
| [19.5, 29.5) | 24.5 | 11 | 17 | 0.3667 | 0.5667 | 36.67 |
| [29.5, 39.5) | 34.5 | 8 | 25 | 0.2667 | 0.8333 | 26.67 |
| [39.5, 49.5] | 44.5 | 5 | 30 | 0.1667 | 1 | 16.67 |
| Total | 30 | 1 | 100 |
Your classes leave a gap of 1 between them, so the class boundaries are used: each limit moves 0.5 outward. For example, 10 to 19 becomes 9.5 to 19.5.
Σ(f · x) = 14.5 · 6 + 24.5 · 11 + 34.5 · 8 + 44.5 · 5, which is 855.
Mean: x̄ = Σ(f · x) ÷ n = 855 ÷ 30, which is 28.5.
Median: n ÷ 2 = 30 ÷ 2 = 15. The cumulative frequency F first reaches 15 or more in the class [19.5, 29.5), so that is the median class.
In that class, L = 19.5, the F before it is 6, f = 11 and c = 10.
Med = L + ((n ÷ 2 - F) ÷ f) · c = 19.5 + ((15 - 6) ÷ 11) · 10, which is about 27.6818.
Mode: the highest frequency is 11, in the class [19.5, 29.5).
d1 = 5 (this class minus the one before it) and d2 = 3 (this class minus the one after it).
Mo = L + (d1 ÷ (d1 + d2)) · c = 19.5 + (5 ÷ (5 + 3)) · 10, which is 25.75.
The class boundaries start at 9.5 and end at 49.5. With them the classes touch and the formulas work with no gaps.
Sturges' rule: how many classes for n values
The rule gives k = 1 + log2(n), rounded up. The middle column is rounded to 2 decimals. For very large samples it tends to give too few classes, so try a few more.
| Number of values (n) | 1 + log₂(n) | Classes (k) |
|---|---|---|
| 10 | 4.32 | 5 |
| 20 | 5.32 | 6 |
| 30 | 5.91 | 6 |
| 40 | 6.32 | 7 |
| 50 | 6.64 | 7 |
| 100 | 7.64 | 8 |
| 200 | 8.64 | 9 |
| 500 | 9.97 | 10 |
| 1000 | 10.97 | 11 |
Frequently asked questions
How many classes should a frequency table have?
For classroom data, between 5 and 12. Sturges' rule is a good starting point: for 40 values it gives 1 + log2(40), which is about 6.32, so 7 classes. Adjust until the histogram shows the shape without too much noise.
Why does the grouped mean differ from the mean of my data?
Because grouping loses the exact position of each value inside its class. The mean uses the class midpoint, and the median and mode come from interpolation. They are estimates.
If you have the ungrouped data, the mean, median and mode calculator gives the exact values.
Which class does a value on a limit go in?
In the class that starts there. Each class includes its lower limit, so 70 goes in [70, 80). The last class also includes its upper limit, so the largest value always fits.
What if my classes are written as 10-19, 20-29?
Type them as 10 19 and 20 29 in the classes and frequencies option. Because the gaps are equal, the calculator uses the class boundaries (9.5 to 19.5, 19.5 to 29.5) and tells you about the adjustment.
What does it mean when two modes show up?
Two classes that are not next to each other share the highest frequency. The distribution is bimodal, which often points to two groups mixed together. The calculator works out one mode for each of them.
Can I use classes with different widths?
Yes, in the classes and frequencies option. The histogram then shows density (f ÷ width), so the area of each bar represents the frequency, and the mode is worked out from those densities.
Learn more
- Frequency tables and histograms: how to build and read them
- Mean, median and mode: which to use
- Variance and standard deviation step by step
Related calculators
- Mean, Median and Mode Calculator
- Standard Deviation Calculator
- Weighted Average Calculator
- Percentage Calculator
You can explore other calculators here.