Historical Volatility Formula: How to Calculate It Step by Step

MarketWatch had a software stock down nearly 20% in a single session this week after its CEO left for Meta. Moves like that do two things. The obvious one is the price damage. The less obvious one lands on every risk system that tracks the name: its measured volatility jumps overnight, and it stays high for a length of time set by the lookback window, not by the market. If you size positions, set stops or run a volatility-targeting rule, you need to know exactly how that number is built.

This post walks through the historical volatility formula one step at a time. It covers a worked example with plain numbers, the faster EWMA and range-based alternatives, and the mistakes that quietly distort a backtest.

What is historical volatility?

Historical volatility (also called realized volatility) is the annualized standard deviation of an asset’s past returns. The standard recipe takes 20 to 60 daily log returns, computes their sample standard deviation, and multiplies by √252 (about 15.87) to convert a daily figure into an annual one. A stock with a daily standard deviation of 1% has a historical volatility of roughly 15.9%.

It is backward-looking by construction. It tells you how much the price actually moved, and that is the difference from implied volatility, which is backed out of option prices and reflects what the market expects. The gap between the two is the subject of our volatility risk premium guide.

Traders use it because risk is far more forecastable than return. Volatility clusters: turbulent weeks tend to follow turbulent weeks, and quiet stretches tend to persist. A good volatility estimate is the input behind position sizing, ATR-style stops, option pricing checks and portfolio risk budgets. Get the estimate wrong and every one of those is wrong too.

The historical volatility formula

The formula has four steps: compute log returns, find their mean, take the sample standard deviation, then annualize. Written out:

  • Log return: rₜ = ln(Pₜ ÷ Pₜ₋₁)
  • Mean: r̄ = (r₁ + r₂ + … + rₙ) ÷ n
  • Sample standard deviation: σ_daily = √[ Σ(rₜ − r̄)² ÷ (n − 1) ]
  • Annualized volatility: σ_annual = σ_daily × √252

Log returns are preferred over simple percentage returns because they add up cleanly across days and behave better statistically. For daily moves under about 3% the two are nearly identical. For larger moves they diverge: a −20% simple return is a −22.3% log return.

The √252 factor comes from the fact that variance scales with time, assuming returns are roughly independent. There are about 252 trading days in a US year, so annual variance is 252 times daily variance, and annual standard deviation is √252 times daily. Weekly data uses √52 and monthly data uses √12. Crypto, which trades every day, is often annualized with √365.

How to calculate historical volatility: a worked example

The calculation is easiest to follow on a short five-day window. Real implementations use 20 days or more, but the arithmetic is identical. Take six daily closes: 100, 101, 99.5, 100.5, 102 and 101.

Step 1: log returns.

DayCloseLog return
1101.0+0.995%
299.5−1.496%
3100.5+1.000%
4102.0+1.482%
5101.0−0.985%

Step 2: mean. The five returns sum to 0.996%, so the mean is 0.199%.

Step 3: squared deviations. Subtract the mean from each return and square it. In units of 0.0001, the squared deviations are 0.634, 2.874, 0.642, 1.645 and 1.402, which sum to 7.197. Divide by n − 1 = 4 to get a daily variance of 1.799, and take the square root: σ_daily ≈ 1.34%.

Step 4: annualize. 1.34% × 15.87 ≈ 21.3% historical volatility.

A spreadsheet does this in one line: =STDEV.S(returns)*SQRT(252), where the returns column holds =LN(B3/B2). In Python it is np.log(close).diff().rolling(20).std() * np.sqrt(252).

Now the shock. Picture a stock that alternates +1% and −1% for 19 days, which gives a 20-day historical volatility of about 16%. On day 20 it drops 20% on a headline. The 20-day reading jumps to about 81%. It stays near that level for the next 19 sessions no matter how quietly the stock trades, and then falls back to about 16% the day the shock leaves the window. That cliff is a feature of the estimator, not of the market. It is sometimes called the “ghost” effect.

Faster and more efficient alternatives: EWMA and range estimators

Close-to-close standard deviation is the default, but two alternatives fix its biggest weaknesses. EWMA weights recent days more heavily, so a shock fades gradually instead of dropping out in one step. Range-based estimators use each day’s high and low, which pulls more information out of the same number of days.

EWMA volatility. J.P. Morgan’s 1994 RiskMetrics methodology updates variance each day as σ²ₜ = λσ²ₜ₋₁ + (1 − λ)r²ₜ, with λ = 0.94 for daily data. Run the same shock through it: the estimate jumps to about 88%, decays to roughly 66% after 10 quiet days, 49% after 20 and 30% after 40. There is no cliff. The trade-off is that EWMA reacts to every new day, so it produces more signal changes and more turnover if you size off it.

Parkinson (1980). This estimator uses only the daily high/low range: σ² = Σ[ln(H/L)]² ÷ (4 ln 2 × n). Because the intraday range captures moves that close-to-close misses, it is roughly five times more statistically efficient under ideal assumptions, so you get a usable estimate from far fewer days. It tends to understate volatility when prices gap overnight, since the gap never shows up in a single day’s range.

Garman-Klass (1980) and Yang-Zhang (2000). These add the open and close to the range. Yang-Zhang also explicitly handles overnight gaps and drift, which makes it the usual choice for single stocks with frequent earnings gaps.

Estimators disagree, especially over short windows. Using hypothetical highs and lows for the five days in the worked example, Parkinson gives about 18.0% against the close-to-close 21.3%. Neither is “right” on five data points. That is the point: pick one, understand its bias, and use it consistently.

Common mistakes when calculating realized volatility

The most common errors don’t come from the math. They come from inputs and conventions that quietly change the output. Each one below can move a volatility estimate by a few points to a few tens of points, and in a backtest that difference compounds into every position size.

Using unadjusted prices. A 2-for-1 split in raw price data looks like a −69% log return and wrecks the window. Always use split- and dividend-adjusted closes.

Mixing annualization factors. Annualizing weekly returns with √252, or daily crypto returns with √252 in one test and √365 in another, makes results incomparable. Write the factor down and keep it fixed.

Choosing the window after seeing results. Ten-day, 20-day and 60-day estimates can differ by a factor of two in a volatile month. Picking whichever window made the backtest look best is a form of data snooping. Fix the window before testing, then check that nearby windows give similar conclusions.

Look-ahead in the estimate. If today’s position is sized with a volatility figure that includes today’s return, the backtest knows the future. Compute the estimate through the prior close and apply it to the next day, as in any clean backtest.

Treating historical volatility as a forecast. It measures the past. After a shock, implied volatility often reprices faster than a 20-day window can. The VIX term structure is a quick cross-check: if near-dated implied volatility sits well above your realized estimate, the market is pricing more turbulence ahead than your window has seen.

FAQ

What is a good lookback period for historical volatility?

Twenty trading days, roughly one calendar month, is the most common choice and matches the horizon of the VIX. Ten days reacts faster but is noisy. Sixty to 100 days is steadier and suits slower strategies. Many desks track two windows, such as 20 and 60 days, and treat a wide gap between them as a regime-change signal.

Should I use log returns or simple returns?

Log returns are the standard for volatility because they are additive over time and more symmetric. For typical daily moves the difference is negligible. It becomes material only on large moves, such as earnings gaps or crashes, where log returns are larger in absolute terms on the downside.

What is the difference between historical and implied volatility?

Historical volatility measures how much the price actually moved over a past window. Implied volatility is derived from option prices and reflects the volatility the market expects over the option’s life. Implied has historically run above subsequent realized volatility for equity indexes on average, which is the premium option sellers try to harvest.

Why multiply by the square root of 252?

Variance grows roughly in proportion to time if daily returns are independent, so standard deviation grows with the square root of time. With about 252 trading days a year, multiplying daily volatility by √252 (about 15.87) converts it to an annual figure. The assumption breaks down when returns trend or mean-revert strongly, so treat the annualized number as a convention, not a law.

Key takeaways

  • Historical volatility = sample standard deviation of daily log returns × √252. A 1% daily standard deviation is about 15.9% annualized.
  • A fixed 20-day window weights every day equally, so a single shock inflates the reading for exactly 20 sessions and then drops out all at once.
  • EWMA (λ = 0.94) decays shocks smoothly, and range estimators like Parkinson and Yang-Zhang extract more information from fewer days.
  • Adjusted prices, a fixed annualization factor, a pre-chosen window and prior-close timing matter more than the choice of formula.
  • Historical volatility describes the past. Cross-check it against implied volatility before relying on it as a forecast.