How to calculate stock profit and ROI — the complete formula
A 46.8% ROI over three months and a 46.8% ROI over three years look identical on paper but represent wildly different investment outcomes. Most quick stock-profit estimates — just subtracting purchase price from sale price — miss fees, miss dividends, and don't account for how long the money was actually at work. Here's the complete formula, and why annualized return is the number that actually lets you compare investments fairly.
The basic stock profit formula
The full formula for stock profit is more complete than most people realize:
Profit = (Sale Price − Purchase Price) × Shares + Dividends − Fees
The core piece — sale price minus purchase price, times shares — is what most people calculate mentally. But two components are frequently left out entirely: dividends received during the holding period, and transaction fees, if any applied. Both can meaningfully change the real number, especially over longer holding periods. Even this fuller formula isn't the complete real-world picture — it doesn't account for taxes, bid-ask spread, or slippage (the difference between an expected trade price and the actual fill price). "Complete" here means complete for pre-tax profit calculation purposes, not every possible cost of executing a trade.
What a simple price-only calculation misses
Ignoring dividends is the more common and more costly omission. For dividend-paying stocks held over a year or more, dividend income can represent a significant share of total return — not a rounding error. A stock that appreciates modestly in price but pays a steady 3-4% dividend yield can meaningfully outperform a stock with faster price growth but no dividend, once total return is properly accounted for.
Fees matter less today than they used to. Most major US brokers eliminated stock trading commissions years ago, so for a typical retail stock trade, this term is often zero. It remains relevant for options contracts (which frequently carry per-contract fees), certain mutual funds, some international or OTC securities, and any account still charging commissions.
Every number in this guide is your profit before taxes. What you actually keep depends on your holding period (short-term vs long-term capital gains rates), your tax bracket, and whether the Net Investment Income Tax applies. See our capital gains tax guide for the full breakdown of how much of this profit the IRS actually takes.
The ROI formula
Return on Investment (ROI) converts your dollar profit into a percentage, which makes it possible to compare investments of different sizes:
ROI = (Profit ÷ Total Cost) × 100
ROI is useful but incomplete on its own — it tells you the total return over the entire holding period, but says nothing about how long that period was. A $500 profit on a $1,000 investment is a 50% ROI whether it took two months or five years. Those are extremely different outcomes, and ROI alone can't distinguish between them.
Annualized return — why it's the number that matters
Annualized return converts your total ROI into an equivalent yearly rate, accounting for the actual time the money was invested:
Annualized Return = (1 + ROI)^(365 ÷ Days Held) − 1
This is the same underlying concept as CAGR (Compound Annual Growth Rate) — the standard way professional investors and fund managers report performance, precisely because it allows fair comparison across different time periods. Annualized return answers the question raw ROI can't: "if this rate of return continued for a full year, what would it have been?"
| Scenario | ROI | Days held | Annualized return |
|---|---|---|---|
| Quick trade | 10% | 30 days | ~219%* |
| Medium hold | 10% | 180 days | ~21.3% |
| Long hold | 10% | 1,825 days (5 yrs) | ~1.9% |
*This figure illustrates why annualizing very short holding periods is mathematically valid but practically misleading — no investment sustains a 30-day return rate for a full year. Annualizing tiny time windows can produce eye-catching numbers that aren't useful for real decision-making. Use annualized return cautiously, and generally avoid relying on it, for holding periods under roughly 90 days.
Notice: the identical 10% ROI produces annualized returns ranging from roughly 2% to over 200%, depending entirely on holding period. This is exactly why comparing raw ROI across trades with different timeframes is misleading — and why annualized return is the figure professional investors often use.
A worked example
100 shares of a dividend-paying stock, bought at $50, sold at $72, held for 548 days (about 18 months), with $150 in dividends received and $10 in total fees:
The dividends alone contributed $150 to the total profit — money a naive "sale price minus purchase price" calculation would have missed entirely, a 6.8 percentage point swing in the final ROI figure. And the 29.1% annualized return is the number that fairly compares this position against other investments held for different lengths of time, or against a market benchmark.
Benchmarking your return against the market
Once you have an annualized return figure, you can compare it against a relevant benchmark — most commonly the S&P 500. The S&P 500's long-run average annual total return — meaning price appreciation plus dividends reinvested — has been approximately 10% nominal since 1957, or roughly 6-7% after adjusting for inflation. This is an important distinction: price return alone (excluding dividends) is meaningfully lower over long periods, so make sure you're comparing your total return (as this guide calculates it) against the market's total return, not its price-only figure. This average, however, obscures enormous year-to-year variation: any individual year has landed close to that historical average surprisingly rarely — annual returns are typically either well above or well below the long-run figure, not near it.
A 29.1% annualized return, as in the worked example above, meaningfully outpaces the long-run market average — a genuinely strong result if sustained. But a single position's annualized return over 18 months is a small sample; comparing it to a multi-decade market average isn't a like-for-like comparison. For a fairer benchmark, compare your return against the market's performance over that same specific window, not the long-run historical average.
Calculate your own profit and ROI
Plug in your buy price, sell price, shares, fees, and dividends to see your complete profit picture, ROI, and annualized return.
Try the stock profit calculatorFrequently asked questions
Should I include reinvested dividends (DRIP) in my profit calculation?
Yes, but carefully to avoid double-counting. If dividends were automatically reinvested, they purchased additional shares — meaning your final share count and sale proceeds already partly reflect that reinvestment. Either track your true final share count (including all DRIP purchases) and use that for the sale proceeds calculation, or keep your original share count fixed and separately add the dollar value of reinvested dividends to the dividends line, but not both — doing both overstates your profit.
What's a "good" annualized return?
There's no universal answer — it depends on what you're comparing against and the risk taken to achieve it. Beating the long-run S&P 500 average (roughly 10% nominal) is a common informal benchmark, but a higher return achieved through a much riskier, more volatile position isn't automatically "better" in a risk-adjusted sense. Consistency matters too: an investor who reliably captures 12% annualized returns across many positions has arguably done better than one who got a single 40% annualized return on one lucky trade and lost money on several others.
Does this formula work for partial sales?
Yes, with one adjustment: use only the shares actually sold in your cost basis (purchase price × shares sold), and prorate any dividends received to the period you held those specific shares if you're calculating profit on a partial position. If you have multiple purchase lots at different prices, you'll also need to determine which lot's cost basis applies to the shares sold — see our cost basis guide for how FIFO, LIFO, and Specific Identification handle this.
Why does the 30-day example show such an extreme annualized return?
Because annualizing mathematically assumes the same rate of return compounds continuously for a full year — an assumption that becomes increasingly unrealistic as the actual holding period shrinks. A 10% gain in 30 days genuinely would compound to an enormous number if repeated identically 12 times in a row, but no real investment sustains that. Treat annualized return figures on very short holding periods (under roughly 90 days) as a mathematical curiosity rather than a meaningful performance metric.
How is total return different from price return?
Price return measures only the change in share price. Total return adds dividends (and any other cash distributions) on top of price return — it's the complete picture of what an investment actually earned. Financial benchmarks like "the S&P 500 returned 10% annually" almost always refer to total return with dividends reinvested, not price return alone, since dividends have historically contributed a meaningful share of the index's long-run total return.
This article is for informational and educational purposes only. All figures shown are pre-tax. S&P 500 historical average return figures cited (~10% nominal, ~6-7% real since 1957) are widely cited long-run averages and do not predict future performance; actual annual returns vary substantially. Not financial advice.