Outlier Detection Tool

Detect statistical outliers using IQR, Z-score, and Modified Z-score methods simultaneously. Visualize results with a box plot and strip plot. Runs entirely in the browser.

Samples:

Input Data — one number per line, or comma/space separated

20 values parsed · range [-50.00, 300.00]

Z-score threshold:

Summary Statistics

Count

20

Mean

32.8000

Median

12.0000

Std Dev

75.3350

Min

-50.0000

Max

300.0000

Q1

11.0000

Q3

13.2500

IQR

2.2500

Lower Fence (Q1 − 1.5·IQR)

7.6250

Upper Fence (Q3 + 1.5·IQR)

16.6250

Box Plot + Strip Plot (red = consensus outliers)

-50.011.012.013.3300.0

IQR Method

Outside Q1 − 1.5·IQR to Q3 + 1.5·IQR

-50200300

3 outliers

Z-Score (|z| > 3)

Standard deviations from mean

300

1 outlier

Modified Z-Score (> 3.5)

0.6745·(x − median) / MAD

-50200300

3 outliers

Consensus Outliers (flagged by 2+ methods)

-50200300

3 consensus outliers · removing them leaves 17 values

Outlier Detection Methods Compared

No single method is universally best. Each makes different assumptions about the data distribution and has different sensitivities to the number of outliers present. Using multiple methods and looking for consensus is the most reliable approach for exploratory data analysis.

MethodBased onThresholdAssumes normalityRobust to outliers
IQRQ1, Q3, IQR1.5 × IQRNoYes
Z-ScoreMean, Std Dev|z| > 2/2.5/3YesNo
Modified Z-ScoreMedian, MAD|M| > 3.5ApproximatelyYes

When to Remove Outliers vs Keep Them

Outliers can be genuine data points or errors. Before removing them, investigate their source. Errors (measurement artifacts, data entry mistakes, sensor malfunction) should be removed or corrected. True extreme values that represent real-world phenomena should generally be kept unless the analysis explicitly focuses on the central distribution.

Remove when:

  • — Obvious data entry error (e.g., age = 999)
  • — Instrument or sensor malfunction
  • — Subject belongs to a different population
  • — Value is physically impossible

Keep when:

  • — Represents a rare but real event
  • — The extreme value is the phenomenon you're studying
  • — Model must generalize to all data points
  • — Removing changes conclusions without justification

Summary Statistics Reference

The tool reports the full five-number summary plus mean, standard deviation, and IQR. The median is more informative than the mean when outliers are present because it is not distorted by extreme values. A large difference between mean and median is itself a signal of skewness or outliers. The IQR (Q3 − Q1) captures the spread of the central 50% of the data and is used directly as the basis for the IQR outlier fences.

Frequently Asked Questions

What is the IQR method for detecting outliers?

The Interquartile Range (IQR) method uses the spread of the middle 50% of data. First, calculate Q1 (25th percentile) and Q3 (75th percentile). Then IQR = Q3 − Q1. The lower fence is Q1 − 1.5 × IQR and the upper fence is Q3 + 1.5 × IQR. Any value outside these fences is flagged as an outlier. The 1.5 multiplier (Tukey's rule) is standard: for a normal distribution, it flags about 0.7% of data. Some analyses use 3 × IQR (extreme outliers) for a more conservative threshold. The IQR method is robust because it is based on the median and quartiles, not the mean, so existing outliers do not inflate the threshold.

What is the Z-score method and when should I use it?

The Z-score measures how many standard deviations a value is from the mean: z = (x − mean) / std. Values with |z| > 3 are typically flagged as outliers (about 0.3% of a normal distribution). More conservative thresholds of |z| > 2.5 (about 1.2%) or |z| > 2 (about 5%) can be used for smaller datasets. The Z-score method assumes the data is approximately normally distributed. If the dataset itself contains outliers, they inflate the mean and standard deviation, making the Z-score less effective at detecting them. For contaminated datasets, use the Modified Z-score instead.

What is the Modified Z-score and why is it more robust?

The Modified Z-score uses the median and MAD (Median Absolute Deviation) instead of the mean and standard deviation: M = 0.6745 × (x − median) / MAD. The factor 0.6745 makes the result comparable to standard Z-scores for normal distributions (MAD ≈ 0.6745 × std for a normal distribution). Values with |M| > 3.5 are flagged. Because it uses the median and MAD, it is highly resistant to the influence of existing outliers — the median doesn't change when you add extreme values. This method is recommended by Iglewicz and Hoaglin and is especially useful for small to medium datasets.

What is a consensus outlier and should I always remove outliers?

A consensus outlier is a value flagged by two or more detection methods simultaneously. Using multiple methods reduces false positives: a value that only one method flags might be a legitimate extreme value, while a value flagged by IQR, Z-score, and Modified Z-score is very likely a genuine anomaly or data error. You should not automatically remove outliers. First investigate their cause: measurement errors and data entry mistakes should be corrected or removed, but genuine extreme values in the domain (a rare large sale, a peak sensor reading) should be kept. Removing them blindly can distort analysis and hide important phenomena.

How do box plots visualize outlier detection?

A box plot (box-and-whisker plot) visualizes five statistics: minimum, Q1, median, Q3, and maximum. The box spans Q1 to Q3 (the IQR). The whiskers extend from Q1 to the lowest value within 1.5 × IQR, and from Q3 to the highest value within 1.5 × IQR. Points beyond the whiskers are plotted individually as outlier dots. The strip plot below the box shows every data point along the same axis. Outlier dots are colored red (consensus outliers) so you can immediately see their magnitude and distribution relative to the bulk of the data.