Stock Return Calculator Formula

Understand the math behind the stock return calculator. Each variable explained with a worked example.

Formulas Used

Total Return

total_return_pct = cost_basis > 0 ? (capital_gain + dividends_received) / cost_basis * 100 : 0

Annualized Return

annualized_return = cost_basis > 0 ? (pow((current_value + dividends_received) / cost_basis, 1 / years_held) - 1) * 100 : 0

Total Profit

total_profit = capital_gain + dividends_received

Capital Gain

capital_gain_amount = capital_gain

Variables

VariableDescriptionDefault
purchase_pricePurchase Price per Share(USD)50
current_priceCurrent Price per Share(USD)75
sharesNumber of Shares100
dividends_receivedTotal Dividends Received(USD)500
years_heldYears Held(years)3
cost_basisDerived value= purchase_price * sharescalculated
current_valueDerived value= current_price * sharescalculated
capital_gainDerived value= current_value - cost_basiscalculated

How It Works

Stock Return Calculation

Total Return

Total Return = (Capital Gain + Dividends) / Cost Basis x 100%

Annualized Return (CAGR)

Annualized Return = [(Ending Value + Dividends) / Cost Basis]^(1/Years) - 1

The annualized return normalizes your return to a per-year basis, making it easy to compare investments held for different periods.

Why Include Dividends

Dividends often account for 30-40% of total stock market returns over long periods. Ignoring them understates your actual investment performance.

Worked Example

Bought 100 shares at $50, now worth $75 each, received $500 in dividends over 3 years.

purchase_price = 50current_price = 75shares = 100dividends_received = 500years_held = 3
  1. 01Cost basis = 100 x $50 = $5,000
  2. 02Current value = 100 x $75 = $7,500
  3. 03Capital gain = $7,500 - $5,000 = $2,500
  4. 04Total return = ($2,500 + $500) / $5,000 = 60%
  5. 05Annualized = ($8,000 / $5,000)^(1/3) - 1 = 16.96%

Frequently Asked Questions

What is the difference between total return and price return?

Price return only measures the change in share price. Total return includes dividends and other distributions. Total return gives a more complete picture of investment performance.

How do I calculate return on multiple purchases?

For multiple purchases at different prices, use the total cost basis (sum of all purchase amounts) and total current value. For precise tracking, consider using a dollar-weighted return method.

What is a good annualized stock return?

The S&P 500 has historically returned about 10% annually (7% after inflation). Individual stock returns vary widely. Returns above 15% annualized are considered excellent over multi-year periods.

Learn More

Guide

How to Calculate ROI (Return on Investment)

Learn how to calculate ROI for investments, business projects, and real estate. Covers the basic ROI formula, annualized returns, CAGR, and common pitfalls in ROI analysis.

Ready to run the numbers?

Open Stock Return Calculator