Home › Statistics & Probability › Outlier Detection Calculator
Outlier Detection Calculator
Flags outliers in a list of numbers using Tukey's interquartile-range fences (Q1 − 1.5·IQR, Q3 + 1.5·IQR) or a z-score threshold, and reports the bounds, the outliers and the mean and standard deviation of the remaining values.
When to use
You want to screen a data set for unusually large or small values before summarising it, or need the fences used by box plots.
Do not use when: You need a formal single-outlier test (Grubbs' test), the data are strongly skewed or multimodal (transform first), or you only want quartiles and summary statistics (use descriptive-statistics).
Formula
iqr: outlier if x < Q1 − threshold × IQR or x > Q3 + threshold × IQR (quartiles by linear interpolation, Excel PERCENTILE.INC). z_score: outlier if |x − mean| > threshold × s (sample SD)
Tukey's fences with multiplier 1.5 are the box-plot convention (NIST). The z-score rule cannot flag anything when the threshold exceeds (n − 1)/√n, the largest |z| a sample of size n can contain; a note is added in that case.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
values | number_list | yes | The data set (order does not matter). | |
method | enum: iqr | z_score | default iqr | Detection rule. The IQR rule is robust; the z-score rule uses the mean and SD, which the outliers themselves inflate. | |
threshold | number | no | IQR multiplier (1.5 = usual outliers, 3 = extreme outliers) or |z| cut-off (commonly 2, 2.5 or 3). Defaults: 1.5 for iqr, 3 for z_score. Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
method_description | string | The rule and threshold used. | |
outliers | number_list | Values outside the bounds, sorted ascending (first 60 when there are more). | |
outlier_count | integer | How many values were flagged. | |
lower_bound | number | Values below this are outliers. | |
upper_bound | number | Values above this are outliers. | |
q1 | number | First quartile by linear interpolation (iqr method). | |
q3 | number | Third quartile (iqr method). | |
iqr | number | Q3 − Q1 (iqr method). | |
mean | number | Mean of the full data set. | |
std_dev | number | Sample standard deviation of the full data set. | |
cleaned_count | integer | Number of values within the bounds. | |
cleaned_mean | number | Mean of the values within the bounds. | |
cleaned_std_dev | number | Sample standard deviation of the values within the bounds (needs ≥ 2 kept values). |
Example
1…9 and 50, IQR rule: {"values":[1,2,3,4,5,6,7,8,9,50],"method":"iqr"} → {"outliers":[50],"outlier_count":1,"lower_bound":-3.5,"upper_bound":14.5,"q1":3.25,"q3":7.75,"iqr":4.5,"cleaned_count":9,"cleaned_mean":5}
10…18 and 100, z-score threshold 2: {"values":[10,11,12,13,14,15,16,17,18,100],"method":"z_score","threshold":2} → {"outliers":[100],"outlier_count":1,"mean":22.6,"std_dev":27.3179,"lower_bound":-32.0358,"upper_bound":77.2358,"cleaned_mean":14,"cleaned_std_dev":2.7386}
GET https://tttkmbb.com/api/v1/calculate/outlier-detection?values=1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C50&method=iqr
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/outlier-detection(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/outlier-detection · Markdown: https://tttkmbb.com/statistics/outlier-detection.md · JSON definition: https://tttkmbb.com/statistics/outlier-detection.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="outlier-detection" - OpenAPI operationId:
detect_outliers - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 7.1.6 What are outliers in the data? (government)
- Wikipedia – Outlier (reference)
- Wikipedia – Interquartile range (reference)
FAQ
Why did the z-score method miss an obvious outlier?
The outlier inflates the mean and SD used to judge it (masking). In a sample of 10 the largest possible |z| is 2.85, so a threshold of 3 can never trigger; use the IQR rule or a lower threshold.
Should I delete outliers?
Not automatically. Check for data-entry errors first; genuine extreme values may be the most important observations. Report results with and without them.
Related calculators
- Descriptive Statistics Calculator — Full summary statistics of the same data.
- Z-Score Calculator — Standardise a single value.
- Percentile Calculator — Any percentile of the data by the same interpolation method.