What this calculator answers
This page works out what a stock trade made or lost. You enter the number of shares, the price you paid, the price you sold at, the commission on each trade and how many days you held the position. It returns the profit or loss in money, the return as a percentage of what you paid, and that return restated as a yearly rate so trades of different lengths can be compared. It also shows the cost basis, the sale proceeds and the total commissions on the two trades, and the break-even sell price: the sell price per share at which the proceeds equal the cost basis, so the trade neither gains nor loses. A chart shows the profit or loss across a range of sell prices, and a table breaks the trade down line by line. The same figures are what people mean by a stock profit calculation and a stock return calculation.
The formula
The cost basis B is the shares n times the buy price b, plus the buy commission f. The proceeds N are the shares times the sell price s, less the sell commission g. The profit G is the proceeds minus the cost basis, the return r is the profit divided by the cost basis, and the annualized return a raises one plus the return to the power of 365 over the days held d, then subtracts one. The break-even sell price p is the buy price plus both commissions divided by the number of shares, and the total commissions F are the buy commission plus the sell commission.
B = n·b + f, N = n·s − g, G = N − B, r = G / B, a = (1 + r)^(365 / d) − 1, p = b + (f + g) / n, F = f + g
A holding of exactly 365 days has an annualized return equal to its return.
The break-even solves n·p − g = n·b + f and is exact. The page shows it rounded to the cent, so the figure shown can be a cent below the price that breaks even. With 3 shares bought at 50 and a commission of 5 on each trade, the break-even is 53.333…, shown as $53.33; selling at $53.33 still loses a cent.
A worked example
Buy 100 shares at 50 and sell them at 60, with no commissions. The profit is $1,000.00, a return of 20%. Held for 365 days, the annualized return is the same 20%.
Now take 10 shares bought at 100 and sold at 121 after 730 days. The return is 21%. Stretching two years of growth into a yearly figure gives an annualized return of 10%, which is the rate that, applied in each of the two years, produces the same total gain.
Last, a loss with commissions: 50 shares bought at 80 and sold at 60, with a commission of $4.95 on each trade, held for 180 days. The cost basis is $4,004.95 and the sale proceeds are $2,995.05, so the profit or loss is -$1,009.90, a return of -25.22%. The total commissions are $9.90. Spread over 50 shares that is 19.8 cents a share, so the break-even sell price is $80.20. The annualized return is -44.52%. The holding is under 365 days, so the calculator shows its short-holding warning; the GIPS rule below explains why.
Reading the chart and the table
The Chart tab plots the profit or loss at each sell price, with the shares and commissions you entered, and the line crosses zero at the break-even sell price. By default the prices run from half to one and a half times the buy price, widened if the sell price or the break-even falls outside that. Under Advanced options, Lowest sell price shown and Highest sell price shown set the range; an end left at 0 is chosen for you. The Table tab’s trade breakdown lists seven figures: the cost of the shares, the buy commission, the cost basis, the sale value of the shares, the sell commission, the sale proceeds and the profit or loss.
What the result does not include
The figures cover the trade itself and nothing around it. Dividends you received while holding the shares are not added in, taxes on the gain are not subtracted, and currency effects on a foreign stock are not considered.
The annualized return is an extrapolation. It assumes the same rate of growth continued for a full year, which a short holding rarely shows. The CFA Institute’s GIPS standards say returns for periods of less than one year must not be annualized.
FAQ
Does the calculator include dividends or taxes?
No. It looks only at the buy price, the sell price, the commissions you enter and the number of days held. Dividends received, taxes on the gain and currency effects are not part of the figures.
How are commissions treated?
Each commission is one flat amount for the whole trade, not an amount per share, so a per-share or percentage-based fee has to be worked out as a total for the trade first. Adding the buy commission to the cost basis and taking the sell commission off the proceeds follows IRS Publication 550, where the basis includes the costs of purchase and the amount realized is what you receive minus selling expenses.
Why can the annualized return look extreme?
Annualizing a holding of less than a year stretches a short result across a whole year, so a small gain over a few days can turn into an enormous yearly figure. The calculator warns you when you hold for under 365 days, and shows a dash where a holding under a year annualizes to more than 1,000,000%, or where the sell commission is larger than the sale value, which is the shares times the sell price.
Should I annualize a holding of less than a year?
Not as a record of what was earned. The CFA Institute's GIPS standards say returns for periods under one year must not be annualized, so the annualized figure for a holding under a year is shown for comparison only; for a short holding, the plain return is the figure that was actually earned.