Capital Gains Calculator

Enter the purchase price, sale price, and number of shares to find the capital gain or loss.

How it is calculated

The tool works per share and then scales up: gain = (sell_price − buy_price) × shares and return % = (sell_price − buy_price) / buy_price × 100. Prices are per share or per unit in the same currency, and the share count can be fractional. The status line says gain, loss or break-even depending on the sign of the result; a loss is shown as a negative number. The buy price must be above zero and the sale price may be zero (a total loss). The tool does not subtract brokerage commissions, fees or taxes, and it does not apply a short-term or long-term tax rate, so the figure is the pre-tax gain on the price movement only.

Worked example

You bought 120 shares at $42.50 and sold them at $58.75. Price change per share: 58.75 − 42.50 = 16.25. Gain: 16.25 × 120 = $1,950.00. Return: 16.25 / 42.50 = 0.3824, or 38.24%. The status reads Capital gain. If the same shares had been sold at $30 instead, the result would be a loss of $1,500.00 and a return of −29.41%.

Try this example →

Common mistakes

  • Entering the total amount paid as the buy price instead of the price per share; the tool multiplies by the share count itself.
  • Ignoring commissions and fees: they reduce the real profit, but this tool does not subtract them, so enter an adjusted price or deduct them yourself.
  • Treating the displayed gain as the taxable amount: the result is before tax and no holding-period rule is applied.
  • Mixing currencies, for example buying in euros and entering the sale price in dollars without converting.
  • Confusing return with gain: a 38% return is a ratio on cost, not a money amount.

Sources

About this calculator

A capital gain (or loss) is the difference between what you paid for an asset and what you sold it for, multiplied by the number of shares or units involved: (sale price minus purchase price) times shares. The return expresses that gain as a percentage of the original cost basis, making it easy to compare the performance of positions bought at different prices.

Investors and tax filers use this figure for far more than bragging rights — most tax systems tax capital gains differently depending on how long the asset was held, commonly splitting gains into short-term (held roughly a year or less, often taxed like ordinary income) and long-term (held longer, often at a reduced rate). Knowing the exact gain or loss on a sale is the starting point for that tax calculation as well as for tracking portfolio performance.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Fees change the picture, and the tool leaves them out unless you add them. Buying 100 shares at 40 and selling at 58 shows 1,800.00 and 45.00%. If you paid 0.50 per share in costs on each side, enter 40.50 and 57.50 to get 1,700.00 and 41.98%. The figure is a pre-tax price result, so holding-period rules still apply on top. Do you track your fees per share or per trade?

Popular calculators

All Calculators