Skip to main content

How to Calculate Stock Profit and Loss: Trading Guide

Sarah Williams · 2024-04-21 · 12 min read · Finance

Calculating a trade result properly means including commissions, annualising the return, and knowing the difference between realised and unrealised gains. This guide covers cost basis, percentage vs absolute returns, why a 50% loss needs a 100% gain to recover, and what tax does to the arithmetic.

How to Calculate Stock Profit and Loss

The headline calculation is trivial. The parts people get wrong are the costs, the time period, and the asymmetry of losses.

The basic calculation

\textProfit = (\textSale price × \textShares) - (\textPurchase price × \textShares)

\textReturn \% = \frac\textProfit\textTotal cost × 100

Example. Buy 150 shares at £24.80, sell at £31.50.

Cost: 150 × 24.80 = £3,720 Proceeds: 150 × 31.50 = £4,725 Profit: £1,005 Return: 1005 / 3720 = 27.02\%

That is the version most calculators stop at. It overstates what you actually made.

Include the costs, or the number is fiction

Real trades carry commissions, and on some markets stamp duty or transaction taxes. These apply on both sides.

\textNet profit = \textProceeds - \textCost - \textBuy fee - \textSell fee - \textTaxes

Take the same trade with £8 commission each way and 0.5% stamp duty on purchase:

  • Purchase: £3,720 + £8 commission + £18.60 duty = £3,746.60
  • Sale: £4,725 − £8 commission = £4,717
  • Net profit: £970.40
  • Return: 970.40 / 3746.60 = 25.90\%

The costs consumed 1.12 percentage points — about 3.4% of the gain. On a small position they matter far more. The same trade with 15 shares instead of 150 faces the same £16 of commission against a tenth of the gain, cutting the return to 21.6% — over five points worse, from nothing but fixed costs.

This is why position size matters for cost efficiency, and why frequent small trades are corrosive to returns in a way that is invisible if you only look at price movement.

Cost basis with multiple purchases

Buying the same stock repeatedly means your cost basis is the weighted average:

\textAverage cost = \fracΣ(\textprice_i × \textshares_i)Σ \textshares_i

Example.

\textAverage cost = (6010)/(300) = £20.033 \text per share

Sell all 300 at £23: profit is 300(23 - 20.033) = £890.

Note the average is pulled toward the larger purchases — the 150-share buy at £18.40 has more influence than the 50-share buy at £25. A simple average of the three prices (£21.13) would be wrong.

Tax jurisdictions differ on whether you may instead identify specific lots (FIFO, LIFO or specific identification), which can materially change the taxable gain. Check what applies to you.

Annualised return

A 27% gain means very different things over three months and over three years. To compare, annualise:

\textAnnualised = [(1 + r)^(365)/(d) - 1] × 100

Where r is the total return as a decimal and d the holding period in days.

Example. Our 25.90% net return, held 8 months (243 days):

(1.2590)^365/243 - 1 = (1.2590)^1.5021 - 1 = 0.4133 = 41.33\%

The same 25.90% held 3 years (1,095 days):

(1.2590)^365/1095 - 1 = (1.2590)^0.3333 - 1 = 0.0798 = 7.98\%

Identical profit, wildly different performance. Annualising is the only honest way to compare trades of different durations, or to compare against a benchmark.

A caution: annualising very short holding periods produces absurd figures. A 3% gain held five days annualises to 765%, which is meaningless — it assumes you could repeat that trade 73 times consecutively. Treat annualised figures from holdings under a month as noise.

Why losses hurt more than gains help

This is the asymmetry that catches people, and the arithmetic is unforgiving.

\textGain needed to recover = (L)/(1 - L)

Where L is the fractional loss.

A 50% loss requires a 100% gain to recover — not another 50%. Lose half your capital and you must double what remains just to return to where you started.

The reason is that percentages apply to different bases. Losing 50% of £10,000 leaves £5,000. Gaining 50% of £5,000 gives £7,500, not £10,000.

This is why capital preservation dominates return-chasing in the long run, and why a strategy with modest gains and small drawdowns often beats one with large gains and large drawdowns.

Realised vs unrealised

Unrealised (paper) gains exist while you still hold the position. They can evaporate.

Realised gains are locked in by selling. They are also, generally, when tax becomes due.

The distinction matters practically. A portfolio showing a large unrealised gain has not made you any money you can spend, and the tax liability that will arrive on sale is a real future cost that the headline figure ignores.

Tax

Rules vary by jurisdiction, but two patterns are near-universal.

Holding period usually matters. Many systems tax short-term gains at a higher rate than long-term. In the US, assets held over a year qualify for long-term capital gains rates, typically well below ordinary income rates. Selling at 11 months rather than 13 can cost significantly.

Losses usually offset gains. Realised losses can generally be set against realised gains, reducing the taxable amount. Deliberately realising losses to offset gains is called tax-loss harvesting, and most jurisdictions have anti-avoidance rules — the US wash-sale rule, the UK's 30-day rule — preventing you from immediately repurchasing the same asset.

After-tax return:

\textAfter-tax profit = \textNet profit × (1 - \texttax rate)

Our £970.40 gain at a 20% capital gains rate nets £776.32 — a 20.72% return rather than 25.90%.

Dividends

Total return includes income, not just price movement:

\textTotal return = \frac(P_sell - P_buy) + \textDividendsP_buy × 100

Example. Bought at £20, sold at £22, received £1.20 in dividends over the holding period:

((22 - 20) + 1.20)/(20) = (3.20)/(20) = 16\%

Price appreciation alone was 10%. Ignoring dividends understated the return by more than a third. For income-oriented holdings the omission is even larger — over long periods, reinvested dividends have historically accounted for a substantial share of total equity returns.

Common mistakes

Ignoring commissions and taxes. Especially damaging on small positions and frequent trading.

Comparing raw returns across different holding periods. Annualise first.

Assuming a 50% loss needs a 50% gain to recover. It needs 100%.

Forgetting dividends. Price return is not total return.

Using a simple average for cost basis instead of a share-weighted one.

Annualising very short holds. Mathematically valid, practically meaningless.

Confusing unrealised gains with money you have. They are neither locked in nor tax-paid.

Frequently asked questions

Should I calculate return on the initial investment or current value? On what you actually put in, including costs. Using current value flatters the number by changing the denominator.

How do I handle a partial sale? Apply your cost basis per share to the shares sold. Selling 100 of 300 shares with a £20.033 average cost gives a basis of £2,003.30 for that sale; the remaining 200 keep the same per-share basis.

What about stock splits? A split changes share count and price proportionally without changing value. Adjust your per-share cost basis by the split ratio — a 2-for-1 split halves it. Total basis is unchanged.

Does currency matter for foreign shares? Yes, and it is frequently overlooked. Your return is the combination of the stock's move and the exchange rate move. A share that rose 10% in a currency that fell 12% against yours produced a loss.

How do I compare against a benchmark? Compare total returns over identical periods, both after costs. A 12% return sounds good until the index returned 15% over the same window.

What is a good annual return? Context-dependent. Broad equity indices have historically averaged high single digits annually over long periods, before inflation. Consistently beating that after costs and tax is genuinely difficult, which is the argument for low-cost index investing.

Summary

Profit is proceeds minus cost, but the number is only meaningful once commissions and taxes are subtracted, dividends are added, and the result is annualised so it can be compared to anything else.

The single most useful thing on this page is the recovery table. A 50% loss needs a 100% gain to undo. That asymmetry, more than any return calculation, is what determines long-run outcomes.

Work through a trade including fees with our Stock Profit Calculator.

Topics: stocks, trading, profit and loss, investing, returns, cost basis