How to Calculate Capital Gains Tax

Capital gains tax is owed when you sell an asset (stocks, real estate, collectibles) for more than you paid for it. The tax rate depends on how long you held the asset and your income level. Understanding how to calculate it helps you plan your sales strategically.

Short-Term vs. Long-Term Capital Gains

  • Short-term: Asset held โ‰ค 1 year. Taxed as ordinary income (10%โ€“37% depending on your bracket).
  • Long-term: Asset held > 1 year. Taxed at preferential rates: 0%, 15%, or 20%.

The Basic Formula

Capital Gain = Sale Price โˆ’ Cost Basis
Tax Owed = Capital Gain ร— Applicable Tax Rate

Cost basis includes the purchase price plus any commissions, fees, or improvements.

Step-by-Step Example

You bought 100 shares of stock at $50/share and sold them 2 years later at $80/share.

  1. Cost basis: 100 ร— $50 = $5,000
  2. Sale proceeds: 100 ร— $80 = $8,000
  3. Capital gain: $8,000 โˆ’ $5,000 = $3,000
  4. As a single filer with $60,000 income, your long-term rate is 15%
  5. Tax owed: $3,000 ร— 0.15 = $450

2024 Long-Term Capital Gains Tax Rates

Filing Status0% Rate15% Rate20% Rate
SingleUp to $47,025$47,026โ€“$518,900Over $518,900
Married Filing JointlyUp to $94,050$94,051โ€“$583,750Over $583,750

Net Investment Income Tax (NIIT)

High earners may owe an additional 3.8% NIIT on investment income if their modified AGI exceeds $200,000 (single) or $250,000 (married filing jointly).

Tax-Loss Harvesting

You can offset capital gains by realizing capital losses in the same tax year. If you have $3,000 in gains and $1,200 in losses, you only pay tax on the net $1,800.

Use our capital gains tax calculator to estimate what you'll owe.