The formula
A stock return is two formulas, not one: the total return is the price gain plus the dividends received, and the annualized return is the compounded per-year rate. The initial investment is the buy price times the shares. The price gain is the sell price minus the buy price, times the shares. The total return in dollars is the price gain plus the dividends. The total return percentage is the total return divided by the initial investment, times 100. The annualized return is the end value divided by the initial investment, raised to one over the years, minus one — where the end value is the sell price times the shares plus the dividends. The stock return calculator runs the same seven steps for you.
Step 1 — Gather the five numbers
Start with the five numbers the return depends on: the buy price per share, the sell price per share, the number of shares, the dividends received, and the holding period in years. Our worked example uses 100 shares bought at $50.00 and sold at $65.00, with $120.00 of dividends received over 3 years. Use the prices from your trade confirmations. The dividends are a total dollar amount received over the whole holding period, not per share: if a stock paid $0.30 a share each quarter for 3 years on 100 shares, the total is $0.30 × 4 × 3 × 100 = $360.00, not $0.30. Write the five numbers down first: $50.00, $65.00, 100 shares, $120.00, 3 years.
Step 2 — Work out what you put in
Multiply the buy price by the shares for the initial investment. On the worked example that is $50.00 × 100 = $5,000.00. This is the denominator for everything that follows: it is the money that actually went in, before fees. If you bought in several lots at different prices, add up each lot separately.
Step 3 — Work out the price gain
Subtract the buy price from the sell price, then multiply by the shares. On the worked example that is ($65.00 − $50.00) × 100 = $15.00 × 100 = $1,500.00. The price gain can be negative: selling at $40.00 gives ($40.00 − $50.00) × 100 = −$1,000.00, a loss on price even before dividends.
Step 4 — Add the dividends for the total return
Add the dividends received to the price gain for the total return in dollars. On the worked example that is $1,500.00 + $120.00 = $1,620.00. Dividends are real return: reinvested dividends drive a large share of long-run stock returns, and leaving them out understates the return by exactly the dividend total. The dividend rule matters here: dividends are a total, not per share. With 200 shares the same trade has a $3,000.00 price gain and a $3,120.00 total return — but the percentage is 31.20%, not 32.40%, because the fixed $120.00 spreads over twice the investment.
Step 5 — Divide for the percentage
Divide the total return by the initial investment and multiply by 100 for the total return percentage. On the worked example that is $1,620.00 ÷ $5,000.00 × 100 = 32.40%. The percentage lets you compare trades of different sizes: a $3,120.00 gain on $10,000.00 is 31.20% — the bigger dollar gain is the smaller percentage return, because the dividend did not scale with the position. With no dividends the same trade returns $1,500.00 — 30.00% total — so the $120.00 of dividends is worth 2.40 percentage points.
Step 6 — Compound for the annualized return
Work out the end value — the sell price times the shares plus the dividends — divide it by the initial investment, raise it to one over the years, and subtract one. On the worked example the end value is $65.00 × 100 + $120.00 = $6,620.00, and the annualized return is ($6,620.00 ÷ $5,000.00)^(1 ÷ 3) − 1 = 9.81% a year. The CAGR rule: never divide the total return by the years. $1,620.00 on $5,000.00 over 3 years is 32.40% total but 9.81% a year (1.324^(1/3) − 1), not 10.80%, because dividing by the years ignores compounding. Over one year the annualized return equals the total return — 32.40% — and over 10 years the same 32.40% total is only 2.85% a year.
Step 7 — Check the result against the stock return calculator
Run the same numbers through the stock return calculator and check that it gives the same $1,620.00, 32.40% and 9.81% — if it does not, one of the five numbers is wrong, and that is the number to re-check. Then try the reverses: the smallest sell price for a $2,000.00 total return is $68.80; the smallest whole number of shares for a $1,000.00 total return is 59 shares; the smallest dividends for a $2,000.00 total return are $500.00; and 2 years is the largest whole number of years for the annualized return to stay at 10% or more, at 15.07%. Taxes and broker fees are not in these figures — the capital gains tax on stocks calculator covers the tax side.
Three worked examples
A bigger gain. Sell at $80.00 instead of $65.00 and the price gain is ($80.00 − $50.00) × 100 = $3,000.00, the total return is $3,120.00 — 62.40% total, 17.54% a year. Fifteen dollars more a share nearly doubles the return.
A loss. Sell at $40.00 and the price gain is ($40.00 − $50.00) × 100 = −$1,000.00, so the total return is −$880.00 — −17.60% total, −6.25% a year. The $120.00 of dividends softens the loss but cannot save the trade.
A long hold. Hold the same trade 10 years instead of 3 and the total return is still $1,620.00 — 32.40% total — but the annualized return is only 2.85% a year.
The dividends-vs-price trade-off
Price gain and dividends are the two halves of the return, and they behave differently. The price gain scales with the shares — 200 shares double it to $3,000.00 — while the dividends in our example are a fixed $120.00 total, so they do not scale. That is why the 200-share trade returns 31.20% instead of 32.40%: the price gain doubled, the dividend stayed put, and the investment doubled. A stock that pays a steady dividend rewards a long hold; a stock that pays none puts the whole return on the price. Count both, and count the dividends as a total.
What the return does not tell you
The return is a backward look, not a forecast: a 32.40% gain over 3 years says nothing about the next 3 years. It also hides the path — a stock that fell 40% and recovered looks the same as one that rose steadily, but the two felt very different to hold. The annualized return smooths the whole holding into one steady rate, so it hides the year-to-year swings. And the figures here are before tax and before fees: the capital gains tax on stocks calculator covers the tax side, and the compound interest calculator shows how reinvested returns build over time. Use the return to compare holdings on equal footing — then check the tax bill and the fees.