Capital Gains Tax Calculator

Estimate capital gains tax on a stock sale. Enter your own tax rate — this calculator is jurisdiction-neutral and works for any country's short-term and long-term rates.

Brokerage commissions paid when buying — added to your cost basis.

Brokerage commissions paid when selling — deducted from your proceeds.

More than 365 days = long-term in most jurisdictions (US IRS definition used here).

Enter your actual marginal rate. US long-term rates: 0%, 15%, or 20% depending on income.

Formula

Capital gains tax formula

Cost Basis Acquisition Price × Shares + Acquisition Fees
Proceeds Sale Price × Shares − Sale Fees
Capital Gain Proceeds − Cost Basis
Tax Due max(0, Capital Gain) × Tax Rate%

Design notes: Jurisdiction-neutral — you supply the tax rate. Long-term threshold: holding period > 365 days (US IRS definition). Capital losses produce $0 tax due; loss carry-forward not modelled.

Worked Example

Given

Acquired 100 shares at $50 (fee $5) · Sold at $80 (fee $5) · Held 400 days · Tax rate 15%

Cost Basis
100 × $50 + $5 = $5,005
Proceeds
100 × $80 − $5 = $7,995
Capital Gain (long-term)
$7,995 − $5,005 = $2,990
Tax Due @ 15%
$2,990 × 15% = $448.50

Frequently Asked Questions

What tax rate should I enter?
Enter the actual marginal rate that applies to this gain in your jurisdiction. In the US: long-term capital gains rates are 0%, 15%, or 20% depending on income level; short-term gains are taxed as ordinary income (10%–37%). In the UK the rate is 10% (basic rate) or 20% (higher rate) for listed shares. Always verify with current tax authority guidance or a tax adviser.
What counts as long-term versus short-term?
This calculator uses the US IRS definition: more than 365 days = long-term. A holding period of exactly 365 days or fewer = short-term. Note: some jurisdictions use different thresholds (e.g. Germany uses 1 year exactly; the UK applies a different framework entirely). The calculator flags which category applies but always use your jurisdiction's actual definition.
Are acquisition fees included in cost basis?
Yes. Brokerage commissions and other transaction costs paid at acquisition increase your cost basis, which reduces your taxable gain. Sale fees reduce your proceeds, similarly shrinking the gain. This is standard tax treatment in most jurisdictions.
What happens when I have a capital loss?
When the sale proceeds are less than the cost basis, you have a capital loss and no tax is due on this transaction. The calculator shows $0 for tax due on a loss. However, capital losses may offset other capital gains in the same tax year — carry-forward rules and wash-sale rules (US) are not modelled here.
Does this model tax-loss harvesting or wash-sale rules?
No. This is a single-transaction calculator. Loss offsets against other gains, carry-forwards, wash-sale restrictions, and state/provincial taxes are not included. For portfolio-level tax optimisation, consult a tax professional or dedicated tax software.