MAD calculator
Find how far your numbers sit from their mean on average: for 2, 4, 4, 4, 5, 5, 7 and 9 the mean is 5, the distances add up to 12 and the mean absolute deviation is 1.5, in the units of your data. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Mean absolute deviation, usually abbreviated MAD, is the average distance from each number in a list to the arithmetic mean of that same list. This MAD calculator takes a finite series, computes the mean, averages the absolute residuals, and returns the MAD together with the observation count and the mean so you can audit the steps. Because residuals are not squared, one extreme value does not dominate the result the way it can with variance or standard deviation. An empty list is rejected, and so is any entry that is not a finite number, because the statistic is undefined without at least one valid observation. The path is deterministic: no network, no random sampling, and no clock.
What MAD measures and what you get
Mean absolute deviation answers a simple question: on average, how far is a typical observation from the center of this particular list? The center used here is the arithmetic mean μ, the sum of the numbers divided by the count n. Each observation then contributes the absolute value of its residual |xᵢ − μ|, those absolute residuals are added, and the total is divided by n.
The result lives in the same units as the original measurements, which makes it easier to explain than variance, whose units are squared. A single finite value is valid and yields MAD zero, because the only residual is zero. Two or more values produce a non-negative MAD that is zero only when every entry equals the mean.
If you need population or sample standard deviation, variance, a z-score, or a multi-column CSV profile, use those dedicated tools; this page exists for the short search term MAD and for the exact average of absolute deviations about the mean.
How the list is read and how the two-pass algorithm stays exact
The canonical field is values, an array of finite numbers. Each token is parsed as a decimal; optional signs and scientific notation are allowed. Empty tokens, letters, booleans, and objects fail with a field index in the message so a bad cell does not become a silent zero.
Infinity and NaN are rejected for the same reason. Computation is the classic two-pass method: first the sum and the mean, then the sum of absolute deviations from that mean, then MAD as that sum divided by n. Returning the intermediate sum of absolute deviations lets a student or a reviewer check the arithmetic by hand.
Where a MAD value is useful in study, quality work, and product checks
Classrooms reach for MAD when a first course on spread wants a linear distance before anyone squares residuals. A lab notebook that records repeated measurements of the same quantity can report how far typical repeats sit from the session mean without claiming a full inferential model. A teacher can print an answer key for a short series and know the page will not swap in median absolute deviation or a sample-standard-deviation shortcut.
Engineering and operations teams use the same number as a compact health check: if the MAD of latency, basket size, or error counts collapses toward zero, the column may have frozen; if it jumps, a process may have drifted even when the mean looks stable. Feature pipelines that scale a column by typical absolute residual can call this contract instead of shipping a one-off helper that later drifts from the documented formula. On this page the work runs entirely in your browser.
Use a dedicated standard-deviation tool when you need quadratic spread, and a dedicated median tool when the center should be the median rather than the mean.
What you can do with it
Homework and lab checks
Confirm MAD about the mean for a textbook series or a short lab run, with n, mean, and the sum of absolute deviations shown beside the MAD.
Linear spread monitoring
Watch MAD of latency, basket size, or error counts when a linear, outlier-softer alternative to standard deviation is easier to explain.
FAQ
What does MAD stand for on this page?
MAD means mean absolute deviation about the arithmetic mean: the average of |xᵢ − μ| for every value in the list.
How is the MAD value calculated?
The engine takes the mean of the list, sums the absolute residuals from that mean, and divides by n. The response also returns the intermediate sum of absolute deviations.
Why is an empty list an error?
Averaging absolute deviations over zero observations is undefined.
Does a single number produce a MAD?
Yes. A list of one finite number is valid and yields MAD zero, because the only residual from the mean is zero.
How much does a request cost?
The calculator is free in your browser on this page.
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/mad \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"values":[2,4,4,4,5,5,7,9]}'const res = await fetch("https://api.kit.forhosting.com/stat/mad", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"values": [
2,
4,
4,
4,
5,
5,
7,
9
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/mad",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"values": [
2,
4,
4,
4,
5,
5,
7,
9
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/mad", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"values":[2,4,4,4,5,5,7,9]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"values":[2,4,4,4,5,5,7,9]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/mad", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"values": [
2,
4,
4,
4,
5,
5,
7,
9
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.mad",
"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.
Limits
max_n | 10000 |
max_abs | 1000000000000000 |
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
What MAD measures and what the response contains
This calculator always returns a small, stable payload: n, the mean, the sum of absolute deviations, the MAD itself, and a short formula string. There is no silent fallback to zero when the list is empty, and there is no attempt to guess a number from a label, a boolean, or a nested object.
How the list is read and how the two-pass algorithm stays exact
Aliases data, numbers, list, and x are accepted so a spreadsheet export, a query string, or a typed form can reuse the same contract without renaming columns. A single string of numbers separated by commas, spaces, or semicolons is also accepted when a form posts plain text instead of a JSON array. The engine enforces a published maximum length and a per-value magnitude ceiling so memory and latency stay inside a predictable budget on the free browser path and on the edge Worker. Pair the free browser run on this page with the priced API when you need that identical descriptive result inside an automated pipeline without re-implementing absolute-deviation averaging yourself.
Where a MAD value is useful in study, quality work, and product checks
Through the API each successful lookup costs $0.002; failed validation is not charged, and nothing is stored after the response returns.
Integration use cases
Deterministic test fixtures
Generate a reproducible MAD for unit tests and data-quality gates instead of maintaining a hand-edited table of expected spread values.