Capital gains tax is the tax on profit when you sell an investment or property

When you sell a stock, rental property, or other investment for more than you paid for it, the difference is a capital gain. The IRS taxes that profit. To calculate how much you owe, you subtract what you paid (your cost basis) from what you received when you sold it (your sale price). That number is your taxable gain.

The tax rate depends on how long you held the asset. If you owned it for one year or less, it's taxed as short-term capital gains at your ordinary income tax rate — the same rate as your salary or wages. If you owned it for more than one year, it's long-term capital gains, which has lower rates: 0%, 15%, or 20% depending on your total income for the year.

You report capital gains on your federal tax return using Form 8949 and Schedule D. State taxes on capital gains vary — some states don't tax them at all, while others tax them like ordinary income.

Key Takeaways

  • Capital gain equals sale price minus cost basis; cost basis is usually what you paid plus any improvements or fees, not the current market value.
  • Short-term gains (held one year or less) are taxed at your income tax rate; long-term gains (held over one year) are taxed at 0%, 15%, or 20% depending on your income bracket.
  • You report gains on Form 8949 and Schedule D, and your broker will send you a Form 1099-B showing the sale details.
  • Cost basis can be adjusted for stock splits, reinvested dividends, depreciation deductions, or capital improvements, so keep all purchase and transaction records.

How to find your cost basis

Cost basis is what you paid for the asset, plus any costs directly tied to buying it. For a stock purchase, it's the price per share times the number of shares, plus any broker fees or commissions. For real estate, it's the purchase price plus closing costs, title insurance, and any capital improvements you made — but not routine maintenance or repairs.

If you inherited an asset, your cost basis is usually its fair market value on the date the person died, not what they originally paid. This is called a stepped-up basis and can significantly reduce your taxable gain if the asset increased in value while the previous owner held it.

If you received stock through an employee stock purchase plan or stock options, your cost basis is the price you paid to acquire it, not the price when you exercise the option or when the plan grants it to you. Keep the confirmation documents from your employer or broker showing the exact purchase price and date.

For mutual funds and ETFs, you can choose how to calculate cost basis if you sell only some of your shares. The most common methods are first-in, first-out (FIFO), where you sell the oldest shares first, or specific identification, where you choose which specific shares to sell. Specific identification often results in lower taxes because you can sell the shares with the highest cost basis first, reducing your gain.

Calculating your gain or loss

Subtract your cost basis from your sale price. The result is your capital gain or loss. If the sale price is lower than your cost basis, you have a capital loss, which can reduce your taxable gains in the same year or carry forward to future years.

Example: You bought 100 shares of a stock at $50 per share ($5,000 total). You paid a $10 broker fee. Your cost basis is $5,010. You sell all 100 shares at $75 per share for $7,500, minus a $10 selling fee, leaving you with $7,490. Your capital gain is $7,490 − $5,010 = $2,480.

If you sold the shares within one year of buying them, the $2,480 is a short-term gain and is taxed at your ordinary income rate. If you held them for more than one year, it's a long-term gain and is taxed at the long-term rate that applies to your income level.

Short-term versus long-term rates

The holding period matters because long-term capital gains have lower tax rates. You must own the asset for more than one year (not exactly one year) for it to may have access to as long-term. The holding period starts the day after you buy and ends on the day you sell.

Short-term capital gains are taxed at your marginal income tax rate — the same rate as your wages or salary. For 2024, that ranges from 10% to 37% depending on your income and filing status.

Long-term capital gains are taxed at 0%, 15%, or 20%. Which rate applies depends on your taxable income for the year, not the size of the gain itself. For 2024, the 0% rate applies to single filers with taxable income up to $47,025; the 15% rate applies to income from $47,025 to $518,900; and the 20% rate applies to income over $518,900. These income thresholds change each year and are higher for married filing jointly and lower for married filing separately.

Because long-term rates are lower, timing matters. If you're close to the one-year mark, waiting a few weeks to sell can save you thousands in taxes on a large gain.

Special situations: real estate, inherited assets, and wash sales

If you sell a rental property or investment real estate, you calculate capital gains the same way — sale price minus cost basis. However, if you claimed depreciation deductions on the property while you owned it, those deductions reduce your cost basis, which increases your gain. You may also owe a separate tax called depreciation recapture at a 25% rate on the portion of gain that came from depreciation.

Inherited assets receive a stepped-up basis, meaning your cost basis is the fair market value on the date of death, not what the previous owner paid. This can eliminate or drastically reduce the taxable gain if the asset appreciated while they owned it. You do not owe capital gains tax on the appreciation that happened before you inherited it.

A wash sale occurs when you sell an investment at a loss and buy the same or a substantially identical investment within 30 days before or after the sale. The IRS disallows the loss deduction and adds the loss amount to the cost basis of the new purchase instead. This rule prevents people from claiming a tax loss while maintaining their investment position.

Reporting capital gains on your tax return

You report capital gains on Form 8949 (Sales of Capital Assets), which feeds into Schedule D (Capital Gains and Losses). Schedule D summarizes your short-term and long-term gains and losses separately, then the net amount transfers to your Form 1040.

Your broker sends you a Form 1099-B after the end of the year showing all sales you made. The form includes the sale date, proceeds, and sometimes the cost basis if the broker has that information. Check the 1099-B against your records — brokers sometimes get cost basis wrong, especially for inherited shares or old purchases.

If you have a net capital loss (losses exceed gains), you can deduct up to $3,000 of the loss against your ordinary income in a single year. Any loss above $3,000 carries forward to future years with no time limit. This means a large loss in one year can reduce your taxable income for many years to come.

Frequently Asked Questions

Do I owe capital gains tax if I sell at a loss?

No. If your sale price is less than your cost basis, you have a capital loss, not a gain. You can use the loss to offset capital gains from other sales in the same year. If losses exceed gains, you can deduct up to $3,000 against ordinary income, with the remainder carrying forward to future years.

What if I don't know my original cost basis?

Contact your broker or the company that sold you the asset — they may have records going back years. For very old purchases, you may need to estimate based on historical price data or tax records from that year. If you cannot find the basis, the IRS may allow you to use the fair market value on the date you acquired it, but document your effort to find the original records.

How do I know if my gain is short-term or long-term?

Count the days from the day after you bought the asset to the day you sold it. If that period is one year or less, it's short-term. If it's more than one year, it's long-term. The holding period clock resets if you sell and repurchase the same asset.

Can I reduce my capital gains by donating the asset to charity instead of selling it?

Yes. If you donate appreciated stock or property to a may have access to charity, you avoid the capital gains tax entirely and can deduct the fair market value of the asset as a charitable contribution. This is often more tax-efficient than selling and donating the proceeds, especially for long-held assets with large gains.

Do I owe capital gains tax on cryptocurrency or digital assets?

Yes. The IRS treats cryptocurrency and NFTs as property, not currency. When you sell or trade them, you calculate capital gains the same way: sale price minus cost basis. Your cost basis is what you paid to acquire the asset, including fees. You report the gain on Form 8949 and Schedule D like any other investment.