Stock Capital Gains Tax Calculator

Compute realised gains, loss netting and adjusted basis with AI-powered step-by-step solutions
Gain on 250 shares bought at $41.25 and sold at $68.40 with $9.90 of commissions
Tax on a $6,777.60 gain at a 24% rate versus a 15% rate
Net $8,400 short-term gains, $3,100 short-term losses, $12,000 long-term gains, $15,500 long-term losses
Adjusted basis after a wash sale: 100 shares sold at $35 that cost $42, repurchased at $36

Gain Is Proceeds Minus Basis

Every capital gains calculation starts with one subtraction:

G=ProceedsCost basisG = \text{Proceeds} - \text{Cost basis}

  • Proceeds — shares ×\times sale price, less selling commissions and fees
  • Cost basis — shares ×\times purchase price, plus buying commissions, adjusted for splits, reinvested dividends and any wash-sale disallowance

Tax is then the gain times whatever rate applies to it:

T=G×rateT = G \times \text{rate}

The rate is the part no calculator can supply. Almost every jurisdiction distinguishes gains on assets held a short time from gains on assets held longer, and the thresholds, the rates, the bands and the treatment of losses all differ by country and change from year to year. Frequent trading may also be classified differently from investing.

So the useful division of labour is this: the arithmetic below — basis, gain, netting, adjusted basis — is identical everywhere and is what this page computes. The rate is an input you supply from your own current rules, or from a qualified tax professional. Nothing here is tax advice.

Netting Losses and Wash Sales

The netting order

Gains and losses are combined within each holding-period category first, then across:

  1. Net short-term: ST gainsST losses\text{ST gains} - \text{ST losses}
  2. Net long-term: LT gainsLT losses\text{LT gains} - \text{LT losses}
  3. If one is positive and the other negative, offset them

A remaining net loss may be deductible against ordinary income up to a limit and carried forward — but the limit, the carry-forward period and whether it applies at all are jurisdiction-specific.

Basis when lots differ

Selling part of a position requires identifying which shares went. Specific identification uses the chosen lot's basis; FIFO uses the oldest; average cost is permitted for some assets in some places. The method changes GG, sometimes dramatically.

Wash sales

Where the rule exists, selling at a loss and repurchasing a substantially identical security inside the window disallows the loss and adds it to the basis of the replacement:

New basis=Repurchase cost+Disallowed loss\text{New basis} = \text{Repurchase cost} + \text{Disallowed loss}

The loss is deferred, not destroyed — it reappears when the replacement shares are sold.

Trading costs

Net=Gcommissionsfees\text{Net} = G - \text{commissions} - \text{fees}

Commissions belong in the basis and proceeds, not deducted separately afterwards.

Common Mistakes to Avoid

  • Forgetting commissions in the basis: buying costs raise the basis, selling costs reduce proceeds. Both lower the gain, and both are frequently omitted.
  • Ignoring reinvested dividends: each reinvestment is a purchase with its own basis. Leaving them out inflates the gain and taxes the same money twice.
  • Netting across categories first: short-term nets against short-term and long-term against long-term before the two are combined. The order changes the result.
  • Assuming a loss is deductible immediately: a repurchase inside the wash-sale window defers it into the new basis.
  • Applying one rate to a whole year of trading: gains are usually taxed by category, and often by band. A single blended percentage is an estimate at best.
  • Using last year's rates: bands and thresholds are revised regularly. Always confirm the current figures for your jurisdiction.

Examples

Step 1: Proceeds: 250 \times 68.40 = \17{,}100.00$
Step 2: Cost basis: 250 \times 41.25 = \10{,}312.50$
Step 3: Raw gain: 17{,}100.00 - 10{,}312.50 = \6{,}787.50$
Step 4: Net of commissions: 6{,}787.50 - 9.90 = \6{,}777.60$
Step 5: Return on cost: 6,777.60/10,312.5065.72%6{,}777.60/10{,}312.50 \approx 65.72\%
Answer: A realised gain of \6{,}777.60$

Step 1: At 24%24\%: 6{,}777.60 \times 0.24 = \1{,}626.62$
Step 2: At 15%15\%: 6{,}777.60 \times 0.15 = \1{,}016.64$
Step 3: Difference: 1{,}626.62 - 1{,}016.64 = \609.98$
Step 4: After tax the gain is \5{,}150.98oror$5{,}760.96$ respectively
Answer: \1{,}626.62againstagainst$1{,}016.64a— a$609.98$ swing. Which rate applies depends on your holding period and jurisdiction

Step 1: Net short-term: 8{,}400 - 3{,}100 = +\5{,}300$
Step 2: Net long-term: 12{,}000 - 15{,}500 = -\3{,}500$
Step 3: The categories have opposite signs, so they offset: 5{,}300 - 3{,}500 = +\1{,}800$
Step 4: The result is a \1{,}800netshorttermgain,notnet short-term gain, not$5{,}300$
Step 5: At a 24%24\% rate that is 1{,}800 \times 0.24 = \432$
Answer: A net short-term gain of \1{,}800thelongtermlosscancels— the long-term loss cancels$3{,}500$ of the short-term gain

Frequently Asked Questions

Gain = proceeds − cost basis. Proceeds are shares × sale price less selling costs; basis is shares × purchase price plus buying commissions, adjusted for splits, reinvested dividends and any wash-sale disallowance.

Net within each holding-period category first, then offset the categories against each other if their signs differ. $5,300 of net short-term gain against $3,500 of net long-term loss leaves $1,800. What happens to a remaining net loss depends on your jurisdiction's deduction limit and carry-forward rules.

Where the rule applies, repurchasing a substantially identical security within the prescribed window after selling at a loss disallows that loss for now. It is added to the basis of the replacement shares — new basis = repurchase cost + disallowed loss — so the deduction is deferred, not lost.

Whichever rate applies to you. Capital gains rates depend on the holding period, your total income, and your jurisdiction, and they are revised regularly, so this page deliberately takes the rate as an input rather than assuming one. Confirm your current figures with a qualified tax professional.

Related Solvers

Try AI-Math for Free

Get step-by-step solutions to any math problem. Upload a photo or type your question.

Start Solving