🧮
🧮 Math & statistics

Moving Average Calculator (SMA & EMA)

Results update as you type.

Your numbers

Understanding the moving average (SMA and EMA) — concept and principle

A moving average smooths a series of numbers by averaging over a sliding window, so short-term noise fades and the underlying trend becomes visible. It is used for sales and website traffic, temperature records, production data and price charts. This calculator gives the simple moving average (SMA) series for your window, the last SMA value and the last exponential moving average (EMA).

Simple and exponential moving averages with window 3Each simple moving average is the mean of three neighbouring values; the last window 25, 14, 16 gives 18.33, while the EMA with alpha 0.5 ends at 16.81.A 3-value window slides along12151119221518251416SMA12.71517.318.718.319.31918.3each number = average of its windowEMA: α = 2 ÷ (3 + 1) = 0.50.5 × 16 + 0.5 × 17.61 = 16.81half the new value + half the old EMALast SMA (25+14+16)÷3 = 18.33last EMA ≈ 16.81 — reacts faster to the drop
The window average ends at 18.33; the EMA, weighting recent values more, ends at 16.81.

How it is calculated

The result has the same unit as the data.

The principle

The SMA gives equal weight to the last w observations and none to older ones, so random ups and downs partly cancel. The cost is lag: the SMA reflects the centre of its window, about (w − 1) ÷ 2 periods behind the latest value. The EMA instead weights every past value, with weights shrinking by the factor (1 − α) each period, so recent data count most and the average reacts faster to change. The choice α = 2 ÷ (w + 1) makes the average age of the EMA weights equal to that of a w-period SMA.

Worked example

  1. Data: 12, 15, 11, 19, 22, 15, 18, 25, 14, 16; window w = 3.
  2. First SMA: (12 + 15 + 11) ÷ 3 ≈ 12.6667; then 15, 17.3333, 18.6667, 18.3333, 19.3333, 19 and finally (25 + 14 + 16) ÷ 3 ≈ 18.3333.
  3. EMA: α = 2 ÷ 4 = 0.5, start at 12.
  4. Successive EMA values: 13.5, 12.25, 15.625, 18.8125, 16.90625, 17.453125, 21.2265625, 17.61328125.
  5. Last step: 0.5 × 16 + 0.5 × 17.61328125 ≈ 16.8066.

How to read the result

The last EMA (16.81) sits below the last SMA (18.33) because the EMA reacts more strongly to the two latest, lower values (14 and 16). A rising moving average signals an upward trend; when the raw data cross their moving average, the short-term direction may be changing. A longer window gives a smoother line but more delay. Common windows match a natural cycle, such as 7 days for daily data with weekly patterns or 12 months for seasonal monthly data.

Common mistakes

Keep in mind: Early EMA values depend on the starting value. Some tools seed the EMA with the first SMA instead of the first data point, so their numbers differ from this calculator over short series. Moving averages of prices are descriptive tools and not financial advice.

Frequently asked questions

What is the difference between a trailing and a centred moving average?

A trailing average, as here, uses only current and past values. A centred average uses values on both sides of each point, which removes lag but needs future data.

How do I choose the window?

Match it to the noise period you want to remove; with no clear cycle, try several and compare.

Sources: Hyndman, R. J. & Athanasopoulos, G. Forecasting: Principles and Practice (OTexts).

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →