Statistics calculator
Mean, median, mode, range, variance and standard deviation (population and sample) of a list of numbers.
- Version 1
- Checked against 1 published value
- Free, no sign-up
Examples
Result: Classic example
| Count Number of values. |
8 |
|---|---|
| Sum Sum of the values. |
40 exact |
| Mean Arithmetic mean. |
5 exact |
| Median Middle value (mean of the two middle values for an even count). |
4.5 exact |
| Mode Most frequent value(s), exact; empty when no value repeats. |
4 |
| Minimum Smallest value. |
2 exact |
| Maximum Largest value. |
9 exact |
| Range Maximum minus minimum. |
7 exact |
| Population variance Σ(x − mean)² / n. |
4 exact |
| Population std dev Square root of the population variance. |
2 exact |
| Sample variance Σ(x − mean)² / (n − 1) (needs n ≥ 2). |
4.57142857142857 rounded |
| Sample std dev Square root of the sample variance (needs n ≥ 2). |
2.1380899352994 rounded |
Rounding: Half even, 15 significant digits. Calculator math/statistics@1.
How it is calculated
mean = Σx/n; population variance = Σ(x − mean)²/n; sample variance = Σ(x − mean)²/(n − 1); standard deviation = √varianceComputes descriptive statistics exactly. Sums, means and variances are exact fractions; standard deviations are square roots computed with certified arithmetic, so even long lists of decimals give correctly rounded results with no accumulated floating-point error.
References
Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.
Use it from your code
curl https://api.curatedapi.com/v1/calc/math/statistics \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"values": ["2", "4", "4", "4", "5", "5", "7", "9"]
}'
The same call in Python
import os
import requests
payload = {
"values": ["2", "4", "4", "4", "5", "5", "7", "9"],
}
response = requests.post(
"https://api.curatedapi.com/v1/calc/math/statistics",
headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
json=payload,
timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
"values": ["2", "4", "4", "4", "5", "5", "7", "9"],
};
const response = await fetch("https://api.curatedapi.com/v1/calc/math/statistics", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log((await response.json()).result);
MCP tool calc_math_statistics at https://mcp.curatedapi.com.
Inputs, outputs and errors in the API reference.
Put it on your website
<div data-curatedapi-widget="math/statistics" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>
Use a public key registered for your site. Calculations are billed like API calls. How widgets work.
Related calculators
- Expression calculator
- Fraction calculator
- Percentage calculator
- Rounding calculator
- Scientific calculator
Add this calculator to your website
Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.
Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.