Skip to content

Moving Average Calculator

Paste a series and get its moving average — simple, weighted or exponential, trailing or centred — with a chart of the data against the smoothed line, a table you can copy or download, the next-period forecast and one-step-ahead error measures (MAE, RMSE, MAPE) to help you choose a window. Free, no sign-up; the numbers stay in your browser.

0 values read

Paste a column from a spreadsheet (a date or month in the first column and the value in the second), or a list of numbers separated by commas, spaces or new lines. A header row is skipped; blank cells are dropped.

Type of moving average

How many observations each average covers.

Window position

Enter at least two numbers to see a moving average.

How to Use the Moving Average Calculator

  1. 1. Paste your series. One value per line, a list of numbers separated by commas, or two columns copied from a spreadsheet: a label (date, month, year) and the value. A header row is skipped.
  2. 2. Choose the type and window. Simple for equal weights, weighted to favour recent values, exponential for a smooth average with a long memory. The window is how many observations each average covers (for exponential, the span).
  3. 3. Pick trailing or centred. Trailing uses the latest k values, so it can be computed as data arrives. Centred straddles each point, which removes lag but leaves blanks at both ends.
  4. 4. Read the chart and the table. Copy the table to a spreadsheet or download it as CSV. The error measures help compare windows; the working shows the first average with your numbers.

Three Kinds of Moving Average

TypeFormulaCharacter
Simple (SMA)MAₜ = (yₜ + yₜ₋₁ + … + yₜ₋ₖ₊₁) ÷ kEqual weights; drops an old value abruptly when the window moves
Weighted (WMA)MAₜ = Σ wᵢyᵢ ÷ Σ wᵢRecent values count more; the default weights are 1, 2, … k
Exponential (EMA)sₜ = α·yₜ + (1 − α)·sₜ₋₁, α = 2 ÷ (N + 1)Every past value counts, with weights that decay geometrically

A trailing average of k points lags the data by about (k − 1) ÷ 2 periods: it reacts after the series has already turned. A centred average has no lag, which is why it is used to estimate a trend, but it needs values after each point and so cannot forecast. For an even window there is no middle point; a simple centred average then uses the classical 2×k method, giving the two end points half weight so the window is symmetric (this is the 2×12 average used to remove monthly seasonality).

Worked Example

The example is the first 24 months of the classic international airline passengers series (Box and Jenkins), in thousands. The first 3-month simple average is (112 + 118 + 132) ÷ 3 = 120.67, placed at March 1949. The latest one, for December 1950, is 129.00: the average of 133, 114 and 140 — also the forecast for January 1951.

AverageMAERMSEMAPEForecasts scored
SMA, k = 315.5119.1211.69%21
SMA, k = 617.7920.8113.22%18
WMA, k = 4 (weights 1 to 4)14.9118.4011.24%20
EMA, α = 0.314.1817.3910.58%23

The series rises and has a yearly rhythm, so every average lags it. The six-month window smooths more but lags more, and so forecasts worse than the three-month one. The weighted and exponential versions follow the data faster than a simple average of similar length and do best here. None of them is a good forecast of a seasonal series, because a moving average cannot anticipate a peak; for that you need a seasonal model.

Choosing a Window

  • Match the cycle. To remove a seasonal pattern, use a window equal to the period: 12 for monthly data with a yearly cycle, 7 for daily data with a weekly one.
  • Trade smoothness against lag. A larger window gives a smoother line that reacts later. The one-step-ahead errors are a rough guide; they reward windows that track recent values.
  • Mind the ends. A trailing window has no value until k points exist. The partial-window option averages what is there at the start, but those first values rest on fewer data points and are noisier.
  • Keep the units. The average is in the units of the series, so it is easy to read against the data, unlike a percentage change.

Frequently Asked Questions

How do you calculate a simple moving average?
Add the last k values and divide by k, then slide the window forward one step and repeat. For the series 4, 6, 8, 10 with k = 3, the first average is (4 + 6 + 8) ÷ 3 = 6 and the next is (6 + 8 + 10) ÷ 3 = 8. The first k − 1 positions have no value because the window is not yet full.
What is the difference between SMA, WMA and EMA?
A simple moving average weights every value in the window equally. A weighted average gives chosen weights — usually larger for recent values. An exponential average uses all past data with weights that shrink by a constant factor, so it needs no window, only a smoothing factor α. EMA and WMA react faster to change than an SMA of the same length.
How is the exponential moving average's alpha chosen?
Either directly (0 < α ≤ 1; larger means faster reaction) or from a span N as α = 2 ÷ (N + 1), the convention in finance and in pandas' ewm(span = N). A 20-period EMA therefore has α = 0.0952. The first value is usually the first observation; technical-analysis charts often start from the simple average of the first N instead, and the calculator offers both.
What is the difference between a trailing and a centred moving average?
A trailing average at time t uses the current and previous observations, so it can be calculated live but lags the data. A centred average uses observations on both sides of t, so it tracks the trend without lag but cannot be computed for the latest points and cannot be used for forecasting.
What window size should I use?
Use the length of the cycle you want to remove (12 for monthly seasonality, 7 for weekly) or choose the window that gives the smallest one-step-ahead error if you want to forecast. There is no universal answer: a longer window smooths more but lags more.
Can a moving average be used to forecast?
Only crudely. A trailing average gives a flat forecast equal to its latest value, which suits a series that wanders around a stable level and fails when there is a trend or seasonal pattern. The error measures on this page show how well it would have forecast your own series.

Related Tools

More in Statistics Calculators

See all Statistics Calculators