A capital gain is the profit you make when you sell an asset — stock, a fund, crypto, or property — for more than your cost basis. The tax you owe depends on how long you held the asset and your income level. Understanding the rules helps you time sales and avoid surprises at tax time.

Basis, proceeds, and the gain

Your capital gain equals the sale proceeds minus your cost basis, which is generally what you paid plus commissions and reinvested dividends. If you sell for less than basis, you have a capital loss instead, which can offset gains. Only the gain is taxed, not the full sale amount — you already paid for the original investment with after-tax money. Keeping accurate basis records is essential, and brokers now report basis for most securities.

Realized vs. unrealized gains

A gain is unrealized while you still hold the asset and only becomes taxable when you realize it by selling. This means you can watch an investment grow for years without owing anything until you sell. Buy-and-hold investors use this to defer taxes indefinitely and let the full balance compound. Nothing is due simply because your portfolio went up on paper.

How the rate is determined

Assets held one year or less produce short-term gains, taxed at your ordinary income rate. Assets held longer than a year produce long-term gains, taxed at preferential rates of 0%, 15%, or 20% depending on your taxable income. High earners may also owe an extra 3.8% net investment income tax. The holding-period distinction is the single biggest lever over your capital gains bill.

Offsetting gains with losses

Capital losses first offset capital gains of the same type, then the other type, and any remaining loss can offset up to $3,000 of ordinary income per year. Unused losses carry forward to future years indefinitely. This is why investors sometimes sell losing positions on purpose, a practice called tax-loss harvesting. Netting gains and losses within a year can substantially reduce what you owe.

You buy 100 shares at $50 ($5,000 basis) and sell them two years later at $80 ($8,000 proceeds). Your long-term capital gain is $3,000, and if you are in the 15% bracket for long-term gains you owe $450. Held for under a year instead, the same $3,000 would be taxed at your higher ordinary rate.

Key takeaways

  • A capital gain is sale proceeds minus your cost basis, and only the gain is taxed.
  • Gains are unrealized (and untaxed) until you actually sell the asset.
  • Holding longer than a year qualifies for lower long-term rates of 0%, 15%, or 20%.
  • High earners may owe an additional 3.8% net investment income tax.
  • Capital losses offset gains and up to $3,000 of ordinary income, with the rest carried forward.

Common mistakes

FAQ

Do I owe capital gains tax if I don't sell?

No. Gains are only taxed when realized, so simply holding an appreciated asset creates no tax.

Are capital gains taxed by states too?

Many states tax capital gains as ordinary income, so your total rate can be higher than the federal figure alone.