Investing

Capital Gains Calculator

Calculate realized capital gain or loss from purchase and sale prices, quantity, and fees, with an optional user-supplied estimated tax rate on positive gain. Cost basis here is a simplified cost basis — not a legally adjusted tax basis.

Must be greater than zero.

Zero allowed (total write-off of unit price).

Must be greater than zero. Fractional quantities are allowed.

Included in simplified cost basis (default 0).

Subtracted from sale proceeds (default 0).

Optional arithmetic assumption only (0–100%). Not a legally applicable rate.

Your results will appear here

Enter your assumptions and calculate to see the estimated result and supporting details.

How this calculator works

Enter purchase price, sale price, quantity, purchase fees, sale fees, and an optional estimated tax rate.

Results show simplified cost basis, net sale proceeds, gain or loss, return on basis, and estimated tax on positive gain only.

Formula / methodology

simplified cost basis = (purchase price × quantity) + purchase fees
net sale proceeds = (sale price × quantity) − sale fees
gain/loss = net sale proceeds − simplified cost basis
return = gain/loss ÷ simplified cost basis
estimated tax = max(gain, 0) × user-supplied tax rate
  • Actual tax basis may differ due to reinvested distributions, stock splits, corporate actions, return of capital, wash-sale adjustments, and other factors not modeled here.
  • This calculator does not estimate tax deductions, credits, loss carryforwards, loss offsets, or other tax treatment arising from an investment loss.

Worked example

Buy at $50, sell at $70, 100 units, $20 purchase fees, $30 sale fees, 15% user-supplied tax → cost basis $5,020, net proceeds $6,970, gain $1,950, return ≈ 38.84%, estimated tax $292.50, after-tax gain $1,657.50.

Important assumptions

  • Simplified cost basis = gross purchase cost + purchase fees.
  • Estimated tax uses only the user-supplied rate and applies only to positive gain.
  • No short-term vs long-term classification, brackets, or jurisdiction rules are applied.
  • Holding period and wash-sale treatment are not modeled.

Common questions