Moving Average Calculator

Smooth any time series with a Simple or Exponential Moving Average. Enter your values, pick a window, and get the full smoothed series plus an overlaid chart.

What is a moving average?

A moving average replaces each point in a time series with an average of nearby values, computed inside a fixed-length window that slides across the data. It filters out short-term wiggles so the underlying trend becomes easier to see, which is why it's the default smoother in finance, sales forecasting, sports analytics, and anywhere a noisy sensor stream needs to be readable.

The two workhorse variants are the Simple Moving Average (SMA), which averages the last n points with equal weight, and the Exponential Moving Average (EMA), which weights recent points more heavily so the smoothed line reacts faster to real changes in the trend.

Moving averages, piece by piece

Simple Moving Average — average the last n points

An SMA slides a fixed-length window across the series and reports the arithmetic mean of the points inside it. Every value in the window carries equal weight, so a spike stays in the average for exactly n steps before it drops out.

SMAₜ = (xₜ + xₜ₋₁ + … + xₜ₋ₙ₊₁) / n
xₜvalue at time t·nwindow length
window n = 3
Example
Given
series 10, 12, 14, 13, 15, …
n = 3
Substitute
SMA₃ = (10 + 12 + 14)/3
SMA₄ = (12 + 14 + 13)/3
Answer
SMA = 12, 13, 14, …

Exponential Moving Average — geometrically decaying weights

The EMA is a recursive weighted average: the newest point gets weight α, the previous EMA carries the rest. Weights on older points shrink geometrically, so the recent past dominates without any point ever being fully forgotten.

EMAₜ = α · xₜ + (1 − α) · EMAₜ₋₁
αsmoothing factor in (0, 1)·EMAₜ₋₁previous EMA value
t−0t−1t−2t−3t−4t−5α = 0.5
Example
Given
seed EMA₃ = 12
α = 0.5
next x = 13
Substitute
EMA₄ = 0.5·13 + 0.5·12
Answer
EMA₄ = 12.5

Choosing α from the window size

The convention α = 2 / (n + 1) makes an EMA behave like an n-period SMA in the sense that both have the same centre-of-mass. Larger n means smaller α, which means more smoothing and slower response to new data.

α = 2 / (n + 1) · smaller α ⇒ smoother
slower EMA
nequivalent window length
n=30.50n=50.33n=100.18n=200.10n=500.04
Example
Given
n = 3
Substitute
α = 2 / (3 + 1)
Answer
α = 0.5

Lag: why the EMA catches turning points sooner

Both averages lag the underlying series, but the SMA lags by about (n − 1) / 2 periods because every point in the window is weighted equally. The EMA's front-loaded weights cut that lag roughly in half, at the cost of slightly noisier output.

SMA lag ≈ (n − 1) / 2 · EMA lag ≈ (1 − α) / α
lagperiods behind a rising trend
trendSMA (slow)EMA (fast)
Example
Given
n = 3
α = 0.5
Substitute
SMA lag ≈ 1.0
EMA lag ≈ 1.0 — EMA reacts faster on real turning points
Answer
EMA turns before SMA when trend flips

Common uses

  • Stock and crypto trend analysis — 20-day, 50-day and 200-day moving averages are standard chart overlays.
  • Sales and demand forecasting — smoothing weekly or monthly sales to see the real trend under seasonal noise.
  • Sensor smoothing — cleaning up temperature, GPS or accelerometer signals before feeding them to control logic.
  • Sports analytics — rolling averages for player performance across a season.
  • Website analytics — 7-day rolling active users to remove the weekday/weekend cycle.

Features of this calculator

  • SMA and EMA in one tool — switch modes without re-entering your data.
  • Handles messy pasted input: commas, spaces, tabs, newlines, currency symbols and thousand separators are all cleaned automatically.
  • Full smoothed series shown alongside your raw values in an easy-to-scan table.
  • Overlaid SVG line chart: raw series and moving average on the same axes.
  • Auto or custom EMA smoothing factor — defaults to the standard α = 2 / (n + 1).
  • Show/hide step-by-step working with the exact averages for the first few points.
  • Copy the whole result summary or download the panel as a PNG.

FAQs

+What is a moving average?
A smoothed version of a time series where each point is replaced by an average of the surrounding values inside a fixed window. It hides short-term noise so the underlying trend is easier to see.
+SMA or EMA — which should I use?
Use SMA when you want equal weight for every point in the window and a smoother, slower line. Use EMA when you want the smoothed curve to react quickly to recent changes, as in most short-term trading indicators.
+How do I pick the window size?
Match it to the cycle you want to hide. 7 for daily data with a weekly pattern, 12 for monthly data with a yearly pattern. In finance, 20, 50 and 200 are the go-to short, medium and long-term windows.
+Why does the smoothed series start after the raw one?
An n-point moving average needs n values before it can produce its first output, so the smoothed series is n − 1 points shorter than the raw one at the start.

Related calculators