Time Series Anomaly Detector
Flag anomalies in a series of values with z-score, moving-average or IQR methods, using your own sensitivity threshold and window size.
Time Series Anomaly Detector
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: Z-Score = (X - Mean) / StdDev | Anomaly if |Z| > Threshold
Worked example — 1 anomaly detected out of 10 points | 120ms flagged at Z-score 2.96
Formula
Z-Score = (X - Mean) / StdDev | Anomaly if |Z| > Threshold
The Z-score measures how many standard deviations a data point X is from the mean. Points exceeding the sensitivity threshold are flagged as anomalies. The moving average method calculates Z-scores relative to a local window, and the IQR method uses quartile-based bounds (Q1 - k*IQR, Q3 + k*IQR) for non-parametric detection.
Worked Examples
Example 1: Server Response Time Monitoring
Problem:A server has response times (ms): 45, 48, 42, 47, 44, 120, 46, 43, 49, 45. Detect anomalies using Z-score with threshold of 2.
Solution:Mean = (45+48+42+47+44+120+46+43+49+45) / 10 = 52.9 ms Std Dev = 22.7 ms Upper bound = 52.9 + 2 x 22.7 = 98.3 ms Lower bound = 52.9 - 2 x 22.7 = 7.5 ms Z-score of 120ms = (120 - 52.9) / 22.7 = 2.96 Anomaly detected: 120ms (Z-score 2.96 > 2.0)
Result:1 anomaly detected out of 10 points | 120ms flagged at Z-score 2.96
Example 2: Daily Sales Pattern Analysis
Problem:Daily sales: 500, 520, 490, 510, 505, 480, 515, 200, 510, 500. Use IQR method with 1.5x multiplier to detect unusual days.
Solution:Sorted: 200, 480, 490, 500, 505, 510, 510, 515, 520 Q1 = 490, Q3 = 515 IQR = 515 - 490 = 25 Lower bound = 490 - 1.5 x 25 = 452.5 Upper bound = 515 + 1.5 x 25 = 552.5 Anomaly: 200 (below 452.5)
Result:1 anomaly detected | Day 8 sales of 200 flagged (below IQR lower bound of 452.5)
Frequently Asked Questions
What is a time series anomaly?
A time series anomaly (also called an outlier) is a data point that deviates significantly from the expected pattern or trend in sequential data. Anomalies can be point anomalies (a single unusual value), contextual anomalies (a value that is unusual given its temporal context but might be normal otherwise), or collective anomalies (a sequence of values that together form an unusual pattern). Detecting anomalies is crucial in fields like fraud detection, infrastructure monitoring, medical diagnostics, and quality control where early identification of unusual behavior can prevent costly problems.
What is the Z-score method for anomaly detection?
The Z-score method measures how many standard deviations a data point is from the mean of the dataset. A Z-score of 0 means the value equals the mean, while a Z-score of 2 means the value is 2 standard deviations above the mean. Typically, data points with Z-scores above 2 or 3 (or below -2 or -3) are flagged as anomalies. This method assumes the data follows a roughly normal distribution and works best for stationary time series. For a normal distribution, about 95.4% of values fall within 2 standard deviations, so using a threshold of 2 flags approximately the most extreme 4.6% of values.
When should I use moving average vs Z-score detection?
Use the global Z-score method when your data is stationary (the mean and variance do not change over time) and you want a simple, fast detection approach. Use the moving average method when your data has trends, seasonality, or changing baselines, as it adapts to local patterns. For example, web traffic that grows monthly would benefit from moving average detection because the global mean is not representative of any particular time window. The IQR (Interquartile Range) method is most robust when you have heavy-tailed distributions or do not want to assume normality.
How do I choose the right sensitivity threshold?
The sensitivity threshold controls the tradeoff between false positives (flagging normal data as anomalies) and false negatives (missing real anomalies). A threshold of 2 standard deviations catches about 4.6% of values in normal data, suitable for alerting. A threshold of 3 catches about 0.3%, suitable for critical alerts where you want high confidence. Start with 2 for exploratory analysis and increase to 2.5 or 3 for production monitoring where alert fatigue is a concern. In practice, the right threshold depends on the cost of missing an anomaly versus the cost of investigating a false alarm.
What are the limitations of statistical anomaly detection?
Statistical methods have several limitations. They assume a specific data distribution (often normal), which may not hold for real-world data. They struggle with multimodal distributions, seasonal patterns (without preprocessing), and gradual drift where the baseline slowly changes. Point-based methods miss collective anomalies where individual values are normal but the pattern is unusual. They are also sensitive to contaminated training data: if anomalies are present in the baseline data, they inflate the standard deviation and make future anomalies harder to detect. For complex scenarios, machine learning approaches like Isolation Forests or autoencoders may be more appropriate.
Why can a Z-score never exceed a certain value on a short series?
Because the mean and the standard deviation are computed from the very points you are testing, so one extreme value inflates both and partly hides itself — the masking effect. The exact ceiling depends on the divisor convention: with the sample standard deviation (divisor n - 1) no observation can exceed (n - 1) / sqrt(n), about 2.85 for ten points, while a variance computed with divisor n caps it at sqrt(n - 1), exactly 3. Either way a threshold of 3 can never fire on ten observations. Below about twenty points, prefer the quartile method.
How does the sensitivity setting change the IQR fences?
The IQR method places bounds at Q1 - k x IQR and Q3 + k x IQR, and this tool feeds the sensitivity value straight in as k. Tukey's classic inner fence uses k = 1.5, which flags roughly 0.7 percent of normally distributed data; his outer fence uses k = 3 for values he called far out. Leaving sensitivity at 2 therefore gives noticeably wider fences than the textbook default, so a point that the standard box-plot rule would call an outlier can pass here unflagged.
Why does the moving-average method leave the tested point out of its own window?
If the suspect point sat inside its own window it would pull the local mean towards itself and inflate the local standard deviation, shrinking its own Z-score — masking in miniature. Excluding it turns the comparison into a genuine leave-one-out test against its neighbours. Two consequences follow: the window has to be wide enough to give a stable local mean and spread, and points near the start and end of the series get lopsided windows, so edge flags deserve more scepticism than interior ones.
What should I do about weekly or seasonal patterns before running detection?
Remove them first, or the recurring peak is flagged every single cycle. The standard route is decomposition: split the series into trend, seasonal and remainder components with a method such as STL, then run the detector on the remainder alone. Seasonal differencing — subtracting the value one full period earlier — is a cheaper alternative that also flattens a linear trend. None of the three methods on this page decompose anything, so a raw daily series with a Monday spike will produce a run of false positives.
What does the coefficient of variation add that the standard deviation does not?
CV is the standard deviation divided by the absolute mean and expressed as a percentage, which strips out both units and scale. A latency series in milliseconds and a revenue series in dollars cannot be compared by standard deviation, but their CVs can be: a series near 5 percent is tight, one near 50 percent is noisy and will throw marginal flags at almost any threshold. The caveat is that CV loses meaning when the mean sits near zero, because a vanishing denominator inflates it without limit.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Related Calculators
☁️Cloud Cost Anomaly Detector
Detect unusual cloud spending patterns using statistical analysis
🧮3D Print Time Support Estimator
Calculate 3d print time support estimator with inputs, formulas, and instant results.
🧮Backup Restore Time Estimator
Calculate backup restore time estimator with inputs, formulas, and instant results.
🧮Reading Time Difficulty Estimator
Calculate reading time difficulty estimator with inputs, formulas, and instant results.
🧮Travel Itinerary Optimizer
Calculate travel itinerary optimizer time windows costs with inputs, formulas, and instant results.
🧮Workout Plan Optimizer Time Muscle Groups
Calculate workout plan optimizer time muscle groups with inputs, formulas, and instant results.
🧮Color Palette Balance AI
Calculate color palette balance ai with inputs, formulas, and instant results.
🧮EV Route Charge Planner Range AI
Calculate ev route charge planner range ai with inputs, formulas, and instant results.