Grouped data mode calculator
Estimate the most common value when data come grouped in classes: with boundaries 0, 10, 20, 30 and 40 and counts 5, 9, 12 and 7, the mode is 23.75, inside the 20–30 class. Every step of the working is shown. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Class boundaries
- 0, 10, 20, 30, 40
- Frequencies
- 5, 9, 12, 7
- Calculation mode
- 23.75
- Modal class index
- 2
- Class width
- 10
- Modal frequency
- 12
The grouped data mode calculator estimates the most common value when observations are summarized into class intervals instead of listed individually. Supply the ordered class boundaries and the frequency for every interval. The calculator identifies the single modal class, compares its frequency with the classes immediately before and after it, and interpolates a modal value inside that interval. It also returns the chosen class, its width, neighboring frequencies, and the interpolation fraction so the result is easy to inspect, explain, and reproduce.
Enter boundaries and frequencies in matching order
Grouped observations are represented by intervals and counts. Four intervals therefore require five boundaries. For example, boundaries 0, 10, 20, 30, and 40 describe the classes 0–10, 10–20, 20–30, and 30–40.
Frequencies 5, 9, 12, and 7 attach a count to those same classes in that order. Boundaries must be finite numbers and strictly increase; frequencies must be finite and non-negative. The calculator deliberately requires explicit frequencies because class intervals alone say nothing about where observations are concentrated.
It also requires exactly one more boundary than frequency, preventing a count from being silently attached to the wrong class. Use true class boundaries rather than class labels or midpoints. If a table lists inclusive integer limits such as 10–19 and 20–29, first convert those limits to the continuous boundaries appropriate for the measurement convention, such as 9.5–19.5 and 19.5–29.5.
This keeps the class width and interpolated position meaningful.
Understand the interpolation formula
The modal class is the interval with the greatest frequency. The estimated grouped mode is L + (d1 / (d1 + d2)) × h. Here, L is the lower boundary of the modal class, h is its width, d1 is the modal frequency minus the preceding frequency, and d2 is the modal frequency minus the following frequency.
The fraction places the estimate between the lower and upper boundaries. When the rise from the preceding class is stronger than the fall toward the following class, the result moves farther into the modal interval; when the fall is stronger, it stays closer to the lower edge. The response exposes the modal class index, both boundaries, all three relevant frequencies, class width, and interpolation fraction alongside the final mode.
Those intermediate values make it possible to audit the calculation or show the working in a report. The method estimates a peak from grouped counts; it does not recover an exact observed mode that was lost during grouping.
Interpret the estimate and recognize its limits
Use the returned mode as an estimate of the distribution’s local peak, not as proof that any original observation had exactly that value. Grouping replaces individual values with interval counts, so the answer depends on the chosen boundaries and on the assumption that neighboring frequency changes can locate a peak within the modal class. Wider intervals generally produce a coarser estimate, while different bin choices can move the modal class.
The calculator rejects a tie for the highest frequency because two or more modal classes do not define one unambiguous interpolation neighborhood. If your table has tied peaks, report it as multimodal or revise the analytical method instead of accepting an arbitrary first class. It also rejects all-zero frequencies, descending or repeated boundaries, negative counts, non-finite numbers, and mismatched array lengths.
Frequencies may be fractional weights as well as whole-number counts, provided they are non-negative. For transparent reporting, retain the returned modal class and interpolation fraction with the final value.
What you can do with it
Summarize a grouped survey
Estimate the most common response value when results are published as score bands with respondent counts.
Analyze production measurements
Locate the approximate peak of a measurement distribution after readings have been aggregated into fixed intervals.
Check classroom calculations
Reproduce the grouped-mode formula and inspect every intermediate frequency used in the interpolation.
FAQ
What formula does the calculator use?
It uses L + (d1 / (d1 + d2)) × h, where L and h describe the modal class and d1 and d2 are frequency differences on either side.
Why must I provide one more boundary than frequency?
Each frequency belongs to the interval between two consecutive boundaries, so n intervals require n + 1 edges.
Can the highest frequency be tied?
No. A tie has no unique modal class, so the calculator asks you to report multimodality or choose another method rather than selecting arbitrarily.
Does the result have to be an observed value?
No. It is an estimate inside the modal interval, and the original values are unavailable once the data has been grouped.
How do I enter classes written as 10–19 and 20–29?
Turn those whole-number limits into continuous boundaries first, following how the data were measured, for example 9.5–19.5 and 19.5–29.5. That keeps the class width and the interpolated position meaningful.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/stat/grouped-mode \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"class_boundaries":[0,10,20,30,40],"frequencies":[5,9,12,7]}'const res = await fetch("https://api.kit.forhosting.com/stat/grouped-mode", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"class_boundaries": [
0,
10,
20,
30,
40
],
"frequencies": [
5,
9,
12,
7
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/grouped-mode",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"class_boundaries": [
0,
10,
20,
30,
40
],
"frequencies": [
5,
9,
12,
7
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/grouped-mode", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"class_boundaries":[0,10,20,30,40],"frequencies":[5,9,12,7]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"class_boundaries":[0,10,20,30,40],"frequencies":[5,9,12,7]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/grouped-mode", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"class_boundaries": [
0,
10,
20,
30,
40
],
"frequencies": [
5,
9,
12,
7
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.grouped_mode",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Enter boundaries and frequencies in matching order
Enter every class edge in class_boundaries, from the lowest edge to the highest, and enter one count per interval in frequencies.
Understand the interpolation formula
For a modal class at the beginning or end of the table, the absent neighboring frequency is treated as zero, a common endpoint convention that still provides a deterministic estimate.
Interpret the estimate and recognize its limits
The browser calculator and API use the same deterministic arithmetic. Interactive use is free on the page, while an automated API request costs $0.002; no network lookup, random choice, or time-dependent input affects the result.
Technical questions
What happens when frequencies are missing?
The request returns an invalid_input error because boundaries alone cannot identify a modal class or support interpolation.
How much does an API calculation cost?
Each API request costs $0.002. The same calculation can be run free in the browser.