Capital Gains Calculator
Calculate capital gain or loss on an investment and the tax at a rate you supply.
Please note: A general estimate, not tax advice. Capital gains rules, rates and allowances vary substantially by country and change frequently. Consult a qualified tax professional.
What the Capital Gains Calculator does
A capital gain is the difference between what you sell an asset for and what it cost you, including transaction costs. Tax typically applies only to the amount above any annual allowance, and losses can usually be set against gains.
Formula
Cost basis = Purchase price × Quantity + CostsCapital gain = Sale proceeds − Cost basisTaxable gain = max(0, Gain − Allowance)Tax = Taxable gain × Tax rate
Inputs explained
| Input | Unit | Required | Notes |
|---|---|---|---|
| Purchase price per unit | selected currency | Yes | Accepts more than 0. |
| Sale price per unit | selected currency | Yes | Accepts 0 or more. |
| Quantity | number | Yes | Accepts more than 0. |
| Buying and selling costs | selected currency | Optional | Accepts 0 or more. |
| Capital gains tax rate | % | Optional | — |
| Tax-free allowance | selected currency | Optional | Accepts 0 or more. |
| Currency | one of 10 options | Optional | — |
How to use it
- Choose Currency.
- Enter Purchase price per unit, Sale price per unit and Quantity.
- Optionally add Buying and selling costs, Capital gains tax rate and Tax-free allowance.
- Select Calculate.
Worked example
300 shares bought at $40, sold at $67, $30 of costs, 15% tax, $3,000 allowance.
- Purchase
- 40
- Sale
- 67
- Quantity
- 300
- Costs
- 30
- Rate
- 15
- Allowance
- 3000
Cost basis $12,030, proceeds $20,100, gain $8,070, taxable $5,070, tax $760.50.
Reading the result
- The allowance only ever offsets a positive gain — on a loss, "allowance used" and "taxable gain" both show zero, which does not mean the allowance was wasted, only that it did not apply to this transaction.
- "Return on cost" already nets in buying and selling costs through the cost basis, making it a fairer comparison figure than a raw price-only percentage change.
Assumptions and limitations
- Tax is calculated as a single flat rate applied above the allowance — this does not model tiered or bracketed capital gains rates that some jurisdictions apply to different slices of the same gain.
- The allowance is applied once, to this single transaction — it does not track whether the same annual allowance has already been used against other gains realised this year.
Common mistakes
- Entering only one side's transaction costs — the "costs" field is a single combined figure, so leaving out either the buying or selling cost understates the cost basis and overstates the taxable gain.
- Treating a loss as having no further consequence once shown here — the "loss available to offset" figure exists specifically because it may still have tax value against other gains, not just this one transaction in isolation.
Frequently asked questions
What is the difference between short-term and long-term gains?
Most systems tax assets held beyond a threshold — often a year — at a lower rate. Selling just before that threshold can be an expensive mistake.
Can I use losses to reduce tax?
Generally yes. Losses offset gains in the same year and often carry forward. Some jurisdictions have wash-sale rules preventing you from immediately repurchasing the same asset.