{
  "id": "volatility",
  "version": "d926455a82b4",
  "status": "published",
  "name": "Volatility Calculator",
  "question": "What is the historical volatility?",
  "summary": "Computes the historical volatility of a stock or other asset from typed closing prices: the standard deviation of its log or percent returns, per period and annualized.",
  "category": "finance",
  "subcategory": "investing",
  "url": "https://www.acalculator.org/finance/volatility-calculator",
  "markdown": "https://www.acalculator.org/finance/volatility-calculator.md",
  "kind": "function",
  "method": "rₜ = ln(Pₜ ÷ Pₜ₋₁) or (Pₜ − Pₜ₋₁) ÷ Pₜ₋₁ for t = 1 to n; s = √(Σ (rₜ − r̄)² ÷ (n − 1)); annual volatility = s × √m, where m is the periods per year.",
  "assumptions": [
    "Prices are typed, oldest first, one per period at equal spacing; no quote is looked up.",
    "Annualizing by √(periods per year) assumes the returns of different periods are not correlated.",
    "Dividends and splits are not adjusted for: type adjusted closes if the series has them."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "prices": {
        "title": "Closing prices",
        "description": "The price at the end of each period, oldest first, separated by spaces or new lines.",
        "type": "array",
        "items": {
          "type": "number"
        }
      },
      "returns": {
        "title": "Returns",
        "description": "Log returns ln(Pₜ ÷ Pₜ₋₁), the usual choice for volatility, or plain percent changes (Pₜ − Pₜ₋₁) ÷ Pₜ₋₁.",
        "type": "string",
        "enum": [
          "log",
          "simple"
        ]
      },
      "per": {
        "title": "Periods per year",
        "description": "252 for daily closes on trading days, 52 for weekly closes, 12 for monthly closes.",
        "type": "integer",
        "minimum": 1,
        "maximum": 366
      }
    }
  },
  "outputs": {
    "annual": {
      "label": "Volatility (annualized)",
      "description": "Standard deviation of the returns × √(periods per year), as a percent.",
      "format": "percent"
    },
    "period": {
      "label": "Volatility per period",
      "description": "The sample standard deviation of the returns, as a percent.",
      "format": "percent"
    },
    "mean": {
      "label": "Mean return per period",
      "description": "The average of the returns, as a percent.",
      "format": "percent"
    },
    "count": {
      "label": "Returns",
      "description": "How many returns: one fewer than the prices.",
      "format": "integer"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "prices": "100 102 101 104 103 106",
      "returns": "log",
      "per": 252
    },
    "outputs": {
      "annual": 31.59522251897463,
      "period": 1.9903119381655856,
      "mean": 1.1653781624795023,
      "count": 5
    },
    "text": "From these 5 returns, the annualized historical volatility is 31.6%."
  },
  "examples": [
    {
      "given": {
        "prices": [
          100,
          102,
          101,
          104,
          103,
          106
        ],
        "returns": "log",
        "per": 252
      },
      "expect": {
        "annual": 31.59522251897463,
        "period": 1.9903119381655856,
        "mean": 1.1653781624795023,
        "count": 5
      },
      "source": "NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.6 Measures of Scale (s = √(Σ (Yᵢ − Ȳ)² ÷ (N − 1))). https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm; William F. Sharpe, \"The Sharpe Ratio\" (1994), equations 8 and 9: over T periods the variance is T times and the standard deviation √T times that of one period, for returns that are not serially correlated. https://web.stanford.edu/~wfsharpe/art/sr/sr.htm; hand calculation in content.mdx: ln(102 ÷ 100) = 1.9803%, …; s = 1.990%; × √252 = 31.60%"
    },
    {
      "given": {
        "prices": [
          100,
          102,
          101,
          104,
          103,
          106
        ],
        "returns": "simple",
        "per": 252
      },
      "expect": {
        "annual": 31.880388727909466,
        "period": 2.008275720812268,
        "mean": 1.188197554105013
      },
      "source": "OpenStax, Principles of Finance, 15.5 Using Excel to Make Investment Decisions (monthly return = (Pₜ − Pₜ₋₁) ÷ Pₜ₋₁; the standard deviation of the returns as their volatility). https://openstax.org/books/principles-finance/pages/15-5-using-excel-to-make-investment-decisions; NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.6 Measures of Scale (s = √(Σ (Yᵢ − Ȳ)² ÷ (N − 1))). https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm; William F. Sharpe, \"The Sharpe Ratio\" (1994), equations 8 and 9: over T periods the variance is T times and the standard deviation √T times that of one period, for returns that are not serially correlated. https://web.stanford.edu/~wfsharpe/art/sr/sr.htm; hand calculation in content.mdx: (102 − 100) ÷ 100 = 2%, …; s = 2.008%; × √252 = 31.88%"
    },
    {
      "given": {
        "prices": [
          50,
          52,
          49,
          51,
          55
        ],
        "returns": "simple",
        "per": 12
      },
      "expect": {
        "annual": 20.166785265165515,
        "period": 5.821649450766345,
        "mean": 2.5388847846831037
      },
      "source": "OpenStax, Principles of Finance, 15.5 Using Excel to Make Investment Decisions (monthly return = (Pₜ − Pₜ₋₁) ÷ Pₜ₋₁; the standard deviation of the returns as their volatility). https://openstax.org/books/principles-finance/pages/15-5-using-excel-to-make-investment-decisions; NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.6 Measures of Scale (s = √(Σ (Yᵢ − Ȳ)² ÷ (N − 1))). https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm; William F. Sharpe, \"The Sharpe Ratio\" (1994), equations 8 and 9: over T periods the variance is T times and the standard deviation √T times that of one period, for returns that are not serially correlated. https://web.stanford.edu/~wfsharpe/art/sr/sr.htm; hand calculation in content.mdx: returns 4%, −5.769%, 4.082%, 7.843%; s = 5.822%; × √12 = 20.17%"
    }
  ],
  "sources": [
    "NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.6 Measures of Scale: the sample standard deviation s = √(Σ (Yᵢ − Ȳ)² ÷ (N − 1)). https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm (retrieved 2026-10-18)",
    "OpenStax, Principles of Finance, 15.1 Risk and Return to an Individual Asset and 15.5 Using Excel to Make Investment Decisions: return = (ending price − beginning price) ÷ beginning price, and the standard deviation of the returns (with N − 1) as the measure of volatility. https://openstax.org/books/principles-finance/pages/15-1-risk-and-return-to-an-individual-asset and https://openstax.org/books/principles-finance/pages/15-5-using-excel-to-make-investment-decisions (retrieved 2026-10-18)",
    "William F. Sharpe, \"The Sharpe Ratio\", The Journal of Portfolio Management, Fall 1994, equations 8 and 9: over T periods the variance is T times, and the standard deviation √T times, that of one period, for returns with no serial correlation. https://web.stanford.edu/~wfsharpe/art/sr/sr.htm (retrieved 2026-10-18)",
    "OpenStax, College Algebra 2e, 6.1 Exponential Functions: continuous growth A(t) = a × e^(rt), the basis of the log return r = ln(Pₜ ÷ Pₜ₋₁). https://openstax.org/books/college-algebra-2e/pages/6-1-exponential-functions (retrieved 2026-10-18)"
  ],
  "related": [
    "sharpe-ratio",
    "beta",
    "standard-deviation",
    "stock-profit"
  ],
  "changelog": []
}
