Moving Average Calculator

Smooth a data series with a simple moving average and see every window average plus the latest value.

Math and PercentUpdated 2026-11-183 min read
Moving Average Calculator
Enter values in time order, oldest first. Commas, spaces or semicolons all work.
How many consecutive values go into each average.
Latest moving average
...
Moving average series...
Mean of all values...
Number of window positions...

What it does

A moving average replaces a noisy series with a series of local means. You choose a window length, add up that many consecutive values, divide by the window length and then step forward one value and repeat. The NIST SEMATECH handbook describes this as taking the mean of successive smaller sets of past data, dropping the oldest number as the next one arrives.

The result is a smoothed line that is easier to read than the raw observations. The Dallas Federal Reserve notes that economists use moving averages to reveal an underlying trend in volatile data such as housing permits, where month to month swings can hide the direction of change.

There is a trade off in the choice of window. A short window follows the data closely but keeps much of the noise. A long window removes more noise yet lags a genuine turning point. With N values and a window of n, you get N minus n plus one averages, so a long window also leaves you with fewer points.

This page computes the trailing simple moving average, where each average covers the current value and the values before it. It returns the full series of averages, the most recent one, the mean of the whole input and the count of window positions.

A moving average is a description of past data, not a forecast by itself. It gives equal weight to every value inside the window and no weight to older values. For data with a trend or strong seasonality, a different smoothing method may tell you more.

How to use

  1. Enter the values in time order, from oldest to newest, separated by commas or spaces.
  2. Set the window length to the number of observations you want in each average.
  3. Keep the window at least 2 and no larger than the number of values you entered.
  4. Read the latest moving average as the average of the most recent window.
  5. Use the full series to see how the average changes as older values drop out.
  6. Compare with the mean of all values to see how far the recent window sits from the long run level.

Formula

M_t = (x_t + x_(t-1) + ... + x_(t-n+1)) / n for t from n to N, where n is the window length and N is the number of values.
M_t
The moving average at position t.
x_t
The data value at position t, in time order.
n
Window length, the count of values in each average.
N
Total number of data values entered.
N - n + 1
How many moving averages the series produces.

The first average uses the first n values. Each later average drops the value that left the window and adds the new one, which is why the running total can be updated by subtraction and addition instead of a full resummation. NIST gives the same expression with M as the window size, and the Dallas Fed notes that researchers often use three, four or five month windows. This page uses a trailing window, so the first n-1 positions have no average.

Worked example

Example: five values with a window of 4

Defaults: data 3, 5, 8, 10, 14 and a window length of 4.

  1. The window covers four values at a time, so five observations give two window positions.
  2. First window, values 3, 5, 8, 10: sum is 26, so the average is 26 / 4 = 6.5.
  3. Slide forward one value: drop 3 and add 14, giving 5, 8, 10, 14 with sum 37.
  4. Second average is 37 / 4 = 9.25, which is the latest moving average.
  5. The mean of all five values is (3 + 5 + 8 + 10 + 14) / 5 = 40 / 5 = 8.
  6. The tool shows latest 9.25, series 6.5, 9.25, mean of all values 8 and 2 window positions.

Reference table

Moving averages for short sample series
Data seriesWindowMoving averagesLatest
3, 5, 8, 10, 1446.5, 9.259.25
2, 4, 6, 823, 5, 77
10, 20, 30215, 2525
5, 10, 1531010

Limits

  • Uses a trailing, equally weighted window. It does not compute centred, weighted or exponential moving averages.
  • The first n-1 positions have no average, so a long window shortens the series noticeably.
  • Ignores gaps in time. Values are treated as equally spaced, whatever the real dates are.
  • Does not remove seasonality or a trend, both of which stay visible in the smoothed series.

Common mistakes

  • Entering the newest value first, which changes which values sit in each window.
  • Choosing a window longer than the data and expecting an answer instead of an error.
  • Reading the mean of all values as the latest moving average. They differ whenever the recent window moves away from the long run level.
  • Assuming a smoother line means the underlying process has changed direction.
  • Using a window of 2 on a series with large swings and treating the result as a stable trend.

Try it yourself

Quick checks. Answers sit tucked under each question.

With data 2, 4, 6, 8 and a window of 2, what are the averages?

The windows are 2,4 then 4,6 then 6,8, giving sums 6, 10 and 14 and averages 3, 5 and 7. The latest is 7, the mean of all values is 5 and there are 3 window positions.

Data 10, 20, 30 with a window of 2. What is the latest average?

The two windows give (10+20)/2 = 15 and (20+30)/2 = 25, so the latest moving average is 25. The mean of all three values is 20.

What happens when the window equals the number of values?

There is only one window. For 5, 10, 15 with window 3 the average is 30/3 = 10, so the latest average, the series value and the mean of all values are each 10.

Questions

What is a simple moving average?

The unweighted mean of the most recent n values in a series, recalculated as the window moves forward one value at a time.

Why does the average series start late?

The first n-1 positions do not have n earlier values to draw on, so the first average appears at position n.

Does a larger window give a better average?

It smooths more, but it also reacts more slowly to real changes and leaves fewer averages. The right length depends on the noise and how quickly you need to see a turn.

Is the moving average a forecast?

Not on its own. It summarises recent history. For data with a trend, the NIST handbook notes that other estimators are needed.

Can I use decimals and negative values?

Yes. The tool accepts plain decimal numbers, including negatives, separated by commas, spaces or semicolons.

How is this different from exponential smoothing?

A moving average weights every value in its window equally and forgets older values all at once. Exponential smoothing keeps a weighted memory of the whole past with weights that decay.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.