Free browser tool · No data uploaded

Outlier Calculator — Detect Anomalies in Your Data

An outlier is a data point that lies far outside the main cluster of your numbers. Paste your values, choose a detection method, and get instant results with a box plot, step-by-step calculation, and a breakdown showing exactly how the outliers move your statistics.

  • ✓IQR, Z-score, MAD, Grubbs & Dixon Q
  • ✓Box plot, scatter & histogram
  • ✓Step-by-step workings
All calculations run in your browser. No numbers are uploaded.

Results will appear here

Enter your data on the left and click Detect outliers

STATISTICS · OUTLIER CALCULATOR GUIDE

Outlier Detection: Formulas, Methods, and When to Use Each

This guide covers how each detection method works, the math behind it, and when it's the right tool — including honest limitations. The quick answers are in the FAQ at the bottom.

What Is an Outlier?

An outlier is a data point that falls far outside the range where most of your values cluster. The word "far" needs a precise definition in practice — that's what detection methods provide.

The IQR method defines far as more than 1.5 times the interquartile range beyond Q1 or Q3. The Z-score method defines it as more than 3 standard deviations from the mean. These are conventions, not laws of nature. Different methods can flag different values as outliers in the same dataset.

The statistical definition of outlier is also separate from the question of what to do with one. Finding that a value is statistically unusual doesn't tell you whether it's a measurement error, a data entry mistake, or a genuine extreme event. That judgment requires domain knowledge — the calculator handles the math, not the interpretation.

Mild vs. extreme: the IQR method with k = 1.5 flags mild outliers. The same method with k = 3.0 flags only extreme (far-out) outliers. A value between the two fences is unusual but may not warrant removal.

How to Use This Calculator

  1. Paste your numbers. Type or paste values into the data box. The calculator accepts commas, spaces, tabs, or newlines — including a column copied from Excel or Google Sheets.
  2. Choose a method. IQR is a reasonable default for most datasets. See the method comparison table below for guidance on which method fits your data.
  3. Adjust the options. For IQR, choose between k = 1.5 (mild outliers) and k = 3.0 (extreme only). For Z-score, choose your threshold. For Grubbs and Dixon Q, set a significance level.
  4. Click Detect outliers. Results appear immediately — count badge, per-value table, before/after impact panel, and three chart types.
  5. Expand Show calculation steps to see the full working: sorted data, quartile calculations, fence values, and each data point's status.
  6. Tick Compare all methods to run IQR, Z-score, and Modified Z-score simultaneously and see which values each method flags. Values flagged by all three are the strongest candidates for investigation.
  7. Download the results as a CSV with an outlier flag column, or download a cleaned CSV with outliers removed.
Quartile method and Excel: by default this calculator uses the same quartile calculation as Excel's QUARTILE function (the "inclusive" method). If your manual calculation or another tool gives different Q1/Q3 values, it's likely using a different method — not an error. See the FAQ for details.

IQR Method (Tukey's Fences)

John Tukey described this method in Exploratory Data Analysis (1977). The idea: measure the spread of the middle 50% of your data (that's the interquartile range), then flag anything that falls more than 1.5 times that spread beyond the quartiles.

IQR METHOD (TUKEY'S FENCES)
IQR = Q3 − Q1 Lower fence = Q1 − k × IQR Upper fence = Q3 + k × IQR

k = 1.5 flags mild outliers. k = 3.0 flags only extreme (far-out) outliers. Any value outside the fences is an outlier by this definition.

Why 1.5? Tukey chose it empirically. For perfectly normally distributed data, k = 1.5 flags roughly 0.7% of valid observations — a reasonable false-positive rate for exploratory work. That 0.7% is not a reason to discard flagged values; it means you should expect some false positives, especially in large datasets.

A worked example. Dataset: 72, 68, 75, 70, 71, 73, 69, 74, 95, 42, 71 (exam scores, n = 11). After sorting: 42, 68, 69, 70, 71, 71, 72, 73, 74, 75, 95. Using the inclusive method: Q1 = 69, Q3 = 73.5, IQR = 4.5. Lower fence = 69 − 6.75 = 62.25. Upper fence = 73.5 + 6.75 = 80.25. The values 42 (below 62.25) and 95 (above 80.25) are outliers. Load the "Exam scores" preset to verify.

When IQR works well

The IQR method makes no assumption about your data's distribution. It works on skewed income data, reaction times, test scores, and manufacturing measurements. It also handles multiple outliers better than the Z-score method because it uses the median and quartiles — statistics that extreme values can't distort.

IQR limitations

With fewer than 10 observations, quartile estimates are unreliable. A dataset with n = 4 gives an IQR based on essentially two values. Results in this range should be treated with scepticism. For n ≤ 10 with one known suspect value, the Dixon Q test is more appropriate. The method also depends on which quartile calculation formula you use — see the FAQ for why Excel can produce different results.

To explore a full five-number summary alongside outlier detection, the descriptive statistics calculator gives min, Q1, median, Q3, max, mean, and standard deviation in one place.

Z-Score Method

The Z-score tells you how many standard deviations a value sits from the mean. The standard threshold for outlier detection is |z| > 3, meaning a value more than 3 standard deviations away from the mean. At |z| > 2, you're casting a wider net.

Z-SCORE METHOD
z = (x − x̄) / s where s = sample standard deviation (n − 1 denominator)

Flag values where |z| exceeds the threshold. At threshold 3.0, roughly 0.27% of a normal distribution is flagged by chance.

The method is intuitive and widely cited. For normally distributed data with a large, clean sample and at most one or two outliers, it's a solid choice. The problem is that Z-score is computed from the mean and standard deviation — both of which are sensitive to the very values you're trying to flag.

When Z-score is unreliable

If multiple outliers exist, they inflate the standard deviation, which shrinks every Z-score and can hide the outliers from detection. This is the masking effect, covered below. With n < 25, the mean and standard deviation estimates are too noisy for the Z-score threshold to be meaningful. For skewed data, the method is not appropriate — most values will cluster on one side of the mean, and the threshold distances are asymmetric relative to the actual data distribution.

Modified Z-Score (Median Absolute Deviation)

Iglewicz and Hoaglin proposed this approach in How to Detect and Handle Outliers (1993). It replaces the mean and standard deviation with the median and MAD — the median of absolute deviations from the median. These are resistant statistics that extreme values can't distort, which is precisely the problem the Z-score method has.

MODIFIED Z-SCORE (IGLEWICZ & HOAGLIN, 1993)
MAD = median( |xᵢ − median(x)| ) Mᵢ = 0.6745 × (xᵢ − median) / MAD

Flag values where |Mᵢ| > 3.5. The 0.6745 factor makes this scale-consistent with the standard Z-score for normal data.

Use this method when your data is skewed, when multiple outliers might be present, or when you don't want the outliers themselves to influence the detection threshold. The IQR method has similar robustness; modified Z-score is a good choice when you want a score for each individual value rather than just a fence-based binary flag.

Edge case: if more than half your data points share the same value, MAD equals zero. This calculator uses a standard deviation-based fallback in that case and reports it in the results.

Grubbs Test

The Grubbs test (Grubbs, 1950) is a formal statistical hypothesis test: H₀ is that there are no outliers in the dataset. It tests whether the most extreme value is significantly more extreme than expected for a sample of size n from a normal distribution.

GRUBBS TEST (GRUBBS, 1950)
G = max|xᵢ − x̄| / s

Compare G to the critical value G(α, n) from the Grubbs table. If G exceeds the critical value, the most extreme point is an outlier at significance level α.

Use this when you already have a specific suspect value in mind and you want a formal test with a p-value-style decision. The test requires approximate normality — if your data is heavily skewed, it doesn't apply. It tests only one outlier at a time; applying it iteratively after removing each flagged value inflates the Type I error rate.

This calculator uses precomputed critical values for n = 3 to 100 at α = 0.05 and α = 0.01, with linear interpolation for intermediate sample sizes.

Dixon Q Test

Dixon's Q test (Dixon, 1951) is designed specifically for small samples (n ≤ 30, most reliable for n ≤ 10). It uses the ratio of the gap between a suspected outlier and its nearest neighbour to the total range of the dataset.

DIXON Q TEST (DIXON, 1951)
Q = |xsuspect − xneighbour| / range

Test both the minimum and maximum. Compare Q to the critical value Q(α, n). Used widely in analytical chemistry and clinical laboratory work.

The Q test has real advantages for tiny samples where IQR estimates are unreliable: it uses order statistics and doesn't depend on the mean or standard deviation. Its limitation is that it tests one value at a time (the minimum and maximum) and assumes the rest of the data is clean. With n > 30, switch to IQR or modified Z-score.

Method Comparison

Your situation Recommended method Why
General purpose, any distributionIQR (k = 1.5)No distributional assumptions; robust to multiple outliers
Normally distributed, large sampleZ-score (threshold 3.0)Intuitive interpretation; widely cited in research
Skewed data or multiple suspected outliersModified Z-score (MAD)Resistant to masking; works when Z-score fails
One specific suspected value, normal dataGrubbs testFormal hypothesis test with critical value
Very small sample (n ≤ 10)Dixon Q testDesigned for small samples; uses order statistics
You want a defensible resultCompare all methodsValues flagged by IQR, Z-score, and Modified Z simultaneously are the strongest candidates
Property IQR (Tukey) Z-score Modified Z (MAD) Grubbs Dixon Q
Requires normalityNoApproximatePartialYesNo
Resistant to maskingYesNoYesNoPartial
Tests multiple outliersYesYesYesOne at a timeMin and max
Recommended minimum n1025Any33
Maximum useful nUnlimitedUnlimitedUnlimited~50030

What to Do With an Outlier

Detecting an outlier is step one. What you do next depends on what caused it. The worst response is removing it because it makes your results look cleaner — that's data manipulation, not data analysis.

What you findAction
Value is physically impossible (negative age, survey response of 100 on a 1–5 scale)It's a data entry error. Correct it if the original is recoverable; remove it if not. Document what you did.
Measurement equipment was malfunctioning at that time pointRemove and document the instrument failure.
Transcription error (e.g., 222.0 instead of 22.2)Correct the value if you can verify what it should be.
Value comes from a genuinely different population (a professional athlete in a recreational sports survey)Consider whether mixing populations is valid for your analysis. Stratify if not.
Valid extreme event (stock market crash, once-a-decade storm reading)Keep it. Report both the full analysis and a sensitivity analysis without it.
Cause unknown after investigationReport both analyses — with and without the outlier — and note the difference.

When you keep outliers but want statistics less sensitive to them, consider: the median instead of the mean for central tendency; the IQR instead of standard deviation for spread; a trimmed mean (remove the top and bottom 5% before averaging); or Winsorization (replace extreme values with the fence value rather than discarding them).

How Outliers Affect Your Statistics

Some statistics are sensitive to extreme values; others aren't. This is the core reason why outlier detection matters for most real analyses.

StatisticSensitive to outliers?Reason
MeanYes — stronglyComputed from all values; one large value shifts it in proportion to its distance from the rest
MedianNoDepends on order, not magnitude; a single extreme value can't move the middle
Standard deviationYes — squared deviations amplify extremesOne value 10 units away from the mean contributes 100 to the sum of squared deviations
Interquartile rangeNoBased on the central 50% of data only
Minimum / maximumYes — by definitionAn outlier is typically the new min or max
Pearson correlationYesOne outlier can create or destroy an apparent correlation; use Spearman as a check
Regression slopeYesHigh-leverage points can pull the fitted line strongly

The before/after panel in the calculator shows this numerically for your specific data. For the exam scores example above, removing the two outliers (42 and 95) drops the standard deviation from roughly 14 to 2.3 (an 84% reduction) while moving the mean from 71.5 to 72.0, barely a change at all. The median barely moves either way.

To explore descriptive statistics in depth, see the descriptive statistics calculator. For visualising the full distribution, the histogram maker and box plot maker are natural follow-on tools. If you need to check for missing values in a dataset before running outlier detection, the missing value checker is a useful first step.

Masking and Swamping

These two effects are the most common reasons people get unexpected outlier detection results.

Masking

When several outliers exist together, they inflate the mean and standard deviation. This reduces every Z-score, so the outliers don't breach the threshold and go undetected — they mask each other. Load the "Masking demo" preset (dataset: 1, 2, 2, 3, 3, 3, 4, 4, 100, 150, 200) and compare the Z-score results to the Modified Z-score results. The Z-score method at threshold 3.0 flags none of the extreme values because the standard deviation has been pulled so wide by the values themselves.

The fix: use the IQR method or Modified Z-score (MAD), both of which use median-based statistics that extreme values can't distort.

Swamping

The opposite problem. A cluster of valid extreme values in one tail of your dataset pulls the mean or median toward them, causing the method to flag valid moderate values on the other tail as outliers. This often happens when your data contains two distinct groups that have been merged — a classic case of needing stratification rather than outlier removal.

Code Equivalents (Excel, Python, R)

For reproducibility in spreadsheets and scripts, here are the exact formulas and functions that match what this calculator computes.

Excel — IQR outlier detection
' Data in A2:A100 ' Q1 — matches this calculator's default (inclusive method) =QUARTILE(A2:A100,1) ' Q3 =QUARTILE(A2:A100,3) ' IQR =QUARTILE(A2:A100,3)-QUARTILE(A2:A100,1) ' Lower fence (k=1.5) =QUARTILE(A2:A100,1)-1.5*(QUARTILE(A2:A100,3)-QUARTILE(A2:A100,1)) ' Upper fence =QUARTILE(A2:A100,3)+1.5*(QUARTILE(A2:A100,3)-QUARTILE(A2:A100,1)) ' Flag each value (put in column B, TRUE = outlier) =OR(A2<lower_fence_cell, A2>upper_fence_cell) ' Note: QUARTILE.EXC gives slightly different Q1/Q3 — select ' "Exclusive" in the calculator to match that formula.
Python — NumPy / SciPy
import numpy as np from scipy import stats data = np.array([72, 68, 75, 70, 71, 73, 69, 74, 95, 42, 71]) # IQR method (k=1.5) q1 = np.percentile(data, 25) # matches inclusive method q3 = np.percentile(data, 75) iqr = q3 - q1 lower = q1 - 1.5 * iqr upper = q3 + 1.5 * iqr outliers_iqr = data[(data < lower) | (data > upper)] # Z-score method (sample SD, threshold 3.0) z = (data - np.mean(data)) / np.std(data, ddof=1) outliers_z = data[np.abs(z) > 3.0] # Modified Z-score (MAD) median = np.median(data) mad = np.median(np.abs(data - median)) mod_z = 0.6745 * (data - median) / mad outliers_mad = data[np.abs(mod_z) > 3.5] # Grubbs test (requires scipy.stats) n = len(data) mean, sd = np.mean(data), np.std(data, ddof=1) G = np.max(np.abs(data - mean)) / sd print("IQR outliers:", outliers_iqr) print("Z-score outliers:", outliers_z) print("Modified Z outliers:", outliers_mad) print("Grubbs G statistic:", round(G, 4))
R
data <- c(72, 68, 75, 70, 71, 73, 69, 74, 95, 42, 71) # IQR method (type=7 matches inclusive/Excel QUARTILE) q1 <- quantile(data, 0.25, type = 7) q3 <- quantile(data, 0.75, type = 7) iqr_val <- q3 - q1 lower <- q1 - 1.5 * iqr_val upper <- q3 + 1.5 * iqr_val outliers_iqr <- data[data < lower | data > upper] # Z-score (sample SD) z <- scale(data)[,1] # uses sd(data) with n-1 outliers_z <- data[abs(z) > 3.0] # Modified Z-score (MAD) med <- median(data) mad_val <- median(abs(data - med)) mod_z <- 0.6745 * (data - med) / mad_val outliers_mad <- data[abs(mod_z) > 3.5] # Grubbs test library(outliers) grubbs.test(data) # Dixon Q test dixon.test(data[1:min(length(data), 30)]) cat("IQR outliers:", outliers_iqr, "\n") cat("Z-score outliers:", outliers_z, "\n") cat("Modified Z outliers:", outliers_mad, "\n")

Common Questions

How do you calculate outliers using the IQR method?

Sort your data, find the 25th percentile (Q1) and 75th percentile (Q3), then compute IQR = Q3 − Q1. The lower fence is Q1 − 1.5 × IQR and the upper fence is Q3 + 1.5 × IQR. Any value below the lower fence or above the upper fence is an outlier. This calculator shows each step in the expandable "Show calculation steps" panel.

Why does this calculator give different Q1/Q3 values than Excel?

Excel's QUARTILE function and Excel's QUARTILE.EXC function use different interpolation positions. The default in this calculator matches QUARTILE (inclusive method). Select "Exclusive" in the quartile method dropdown to match QUARTILE.EXC. R's default quantile() uses yet another method (type = 7, which happens to be identical to inclusive for most datasets but can differ). Nine different quartile calculation algorithms exist in the literature — different tools default to different ones, which is why results legitimately differ.

What is the 1.5 IQR rule?

It's the most widely used outlier rule, proposed by John Tukey in 1977. A value is a mild outlier if it lies more than 1.5 × IQR below Q1 or above Q3. A value is an extreme (far-out) outlier if it lies more than 3 × IQR from the nearest quartile. The rule makes no assumption about the underlying distribution.

When should I use Z-score instead of IQR?

Use Z-score when your data follows an approximately normal distribution and you have a large, relatively clean sample (n > 25) with at most one or two outliers. Use IQR when your data is skewed, non-normal, or when multiple outliers might be present. If you're unsure, run both and check whether the results agree. A large discrepancy suggests a nonlinear distribution or the masking effect.

What is the Modified Z-score and why use it?

The Modified Z-score, proposed by Iglewicz and Hoaglin (1993), replaces the mean and standard deviation with the more stable median and MAD (Median Absolute Deviation). The formula is Mᵢ = 0.6745 × (xᵢ − median) / MAD, with |Mᵢ| > 3.5 flagging outliers. Because it's based on the median, it resists the masking effect that defeats the standard Z-score when multiple outliers are present.

Should I remove outliers from my data?

Only remove an outlier if you can establish that it's invalid — a data entry error, a measurement failure, or a value from outside the population you intended to study. Valid extreme values (a genuine record-breaking result, an unusual but real event) should be kept. Removing them without justification is a form of data manipulation. When you're genuinely unsure, report the analysis both ways and note the difference.

What is the masking effect?

When multiple outliers exist in a dataset, they inflate the mean and standard deviation. This pulls the Z-score of each individual outlier closer to zero, so none of them breach the detection threshold. The outliers effectively hide each other — that's masking. The Modified Z-score (MAD) and IQR method resist this effect because they use median-based statistics that the outliers can't distort.

Can I use this with only 5 values?

Yes, with caveats. For IQR, quartile estimates from n = 5 are based on very few data points and should be treated as rough guides rather than precise boundaries. The Dixon Q test is specifically designed for small samples (n = 3 to 10) and is more appropriate. The Grubbs test also works at n = 5. For Z-score and Modified Z-score, the estimates of mean, SD, median, and MAD from 5 observations have wide uncertainty.

How does this tool handle negative values?

All methods work correctly with negative values. The IQR fences, Z-scores, and modified Z-scores can all be negative, and the calculator handles them without issue. If your lower fence is negative, any value more negative than that fence is a low outlier.

What is mild vs extreme outlier in the IQR method?

A mild (potential) outlier falls between the 1.5×IQR and 3×IQR fences — it's unusual and worth investigating. An extreme (far-out) outlier falls beyond the 3×IQR fence — it's very unusual and a stronger candidate for investigation or removal if invalid. This calculator uses different colours in the box plot for each type: orange for mild, red for extreme.

What is the Grubbs test used for?

Grubbs' test is a formal hypothesis test for detecting a single outlier in a normally distributed dataset. It computes a test statistic G = max|xᵢ − mean| / SD and compares it to a critical value that depends on the sample size and significance level. If G exceeds the critical value, the most extreme point is an outlier. It's commonly used in analytical chemistry and quality control. It tests only one point at a time — applying it iteratively inflates the Type I error rate.

What is the Dixon Q test used for?

Dixon's Q test is for very small samples (n ≤ 30, most reliable for n ≤ 10). It tests whether the most extreme minimum or maximum value is an outlier using the ratio Q = gap/range, where gap is the distance from the suspect value to its nearest neighbour and range is the full data span. It's widely used in laboratory settings where sample sizes are small by necessity.

How do outliers affect the mean and standard deviation?

The mean is computed from every value, so a single extreme point can shift it substantially. A standard deviation is worse: it uses squared deviations, so an extreme value contributes disproportionately more than a moderate value. The before/after panel in this calculator shows the numerical impact on your specific dataset — mean, median, standard deviation, minimum, and maximum, with and without the detected outliers.

Why are consensus outliers the most defensible?

Each detection method has different assumptions and vulnerabilities. When IQR, Z-score, and Modified Z-score all flag the same value, that agreement across different mathematical frameworks makes the detection hard to dismiss as an artifact of one method's assumptions. The "Compare all methods" mode in this calculator marks these consensus flags. Values flagged by only one method deserve more scrutiny before action.

How do I find outliers in a scatter plot or for two variables?

This calculator handles one variable at a time. For two variables, one option is to run outlier detection on each variable separately. A more principled approach for two-variable outlier detection is to look for points with high influence or high leverage on a regression line — which is a different kind of analysis. The scatter plot maker lets you visualise two variables together to spot unusual pairs visually. For correlations, the correlation calculator shows the scatter plot alongside Pearson's r and Spearman's rho.

When this tool is useful

One calculator. Five methods. Instant visual output.

Use this tool when you have a list of numbers and need to know which values are statistically unusual. It doesn't handle multiple variables at once or time-series anomaly detection — for those, the full Amridata workspace adds file uploads, AI-assisted analysis, and shareable dashboards built from your own data.