Capital gains tax is the tax you owe when you sell something for more than you paid for it

When you buy a stock, rental property, or other investment and later sell it for a profit, that profit is called a capital gain. The federal government taxes this gain as income. The amount you owe depends on how long you held the asset before selling it, your total income that year, and your filing status. States may also tax capital gains, though rules vary widely.

The tax applies to the profit only, not the full sale price. If you bought a house for $300,000 and sold it for $350,000, your capital gain is $50,000. That $50,000 is what gets taxed, not the entire $350,000.

Key Takeaways

  • Capital gains tax applies only to the profit when you sell an investment or property, not the full sale price.
  • Long-term capital gains (assets held over one year) are taxed at lower rates than short-term gains, which are taxed as ordinary income.
  • Your tax rate depends on your total income for the year and your filing status; rates range from 0% to 20% for federal long-term gains.
  • Most states do not tax capital gains, but some states like California, New York, and Washington have their own capital gains taxes.
  • Primary residences may be exempt from capital gains tax if you meet specific ownership and use requirements.

Long-term versus short-term capital gains

The IRS treats capital gains differently depending on how long you owned the asset. If you held it for more than one year before selling, it is a long-term capital gain. If you held it for one year or less, it is a short-term capital gain.

Short-term capital gains are taxed as ordinary income at your regular tax bracket rate, which can be as high as 37% at the federal level. Long-term capital gains receive preferential treatment and are taxed at lower rates: 0%, 15%, or 20%, depending on your income and filing status. For most people, long-term rates are significantly lower than short-term rates.

This difference matters most for active traders or people who frequently buy and sell investments. Someone who holds a stock for two years pays less tax on the profit than someone who holds it for six months, even if the profit amount is identical.

How your income level determines your tax rate

Your long-term capital gains rate is not fixed. It depends on your total taxable income for the year and whether you file as single, married filing jointly, head of household, or another status. The IRS sets income thresholds each year that determine which rate bracket you fall into.

For 2024, a single filer with taxable income up to $47,025 pays 0% on long-term capital gains. Income from $47,026 to $518,900 is taxed at 15%. Income above $518,900 is taxed at 20%. These thresholds are different for married couples filing jointly, heads of household, and other statuses. The thresholds also change each year for inflation.

This means your capital gains rate depends on your other income that year—wages, interest, dividends, and other sources all count toward the threshold. Someone with a $40,000 salary who sells an investment for a $10,000 gain may pay 0% on that gain, while someone with a $100,000 salary on the same $10,000 gain may pay 15%.

State capital gains taxes

Most states do not tax capital gains at all. However, some states impose their own capital gains tax on top of the federal tax. The rules and rates vary significantly by state.

California taxes capital gains as ordinary income with no preferential rate, meaning rates can reach 13.3% at the state level. New York taxes long-term capital gains at rates up to 6.85%. Washington State imposes a 7% tax on long-term capital gains over $250,000. Other states with capital gains taxes include Oregon, Vermont, and the District of Columbia. If you live in or sell property in one of these places, you will owe both federal and state tax on your gain.

If you live in a state without a capital gains tax, you still owe federal tax. State tax is an additional layer that applies only in certain states.

The primary residence exemption

If you sell your main home, you may not owe capital gains tax on part or all of the profit. The IRS allows you to exclude up to $250,000 of gain if you are single, or $500,000 if you are married filing jointly, provided you meet two requirements.

First, you must have owned the home for at least two of the five years before the sale. Second, you must have lived in it as your primary residence for at least two of those five years. The two years do not have to be consecutive, and they do not have to be the most recent two years, but they must fall within the five-year window before you sell.

If you meet these requirements and your gain is less than the exclusion amount, you owe no capital gains tax on the sale. If your gain exceeds the exclusion—for example, $600,000 on a single filer's home—you owe tax only on the amount above $250,000. Rental properties and investment homes do not may have access to for this exemption.

How to calculate your capital gain

Calculating your capital gain is straightforward: subtract what you paid for the asset from what you sold it for. The difference is your gain (or loss, if you sold for less than you paid).

Your purchase price is your cost basis. For stocks and mutual funds, this is the price you paid plus any fees or commissions. For real estate, it includes the purchase price, closing costs, and certain improvements you made to the property. For inherited assets, the cost basis is usually the fair market value on the date of the person's death, not what they originally paid—this is called a "step-up in basis" and can significantly reduce or eliminate capital gains tax for heirs.

Keep records of your purchase date, purchase price, sale date, and sale price. If you made improvements to a property, keep receipts for those as well. These documents support your calculation if the IRS ever asks.

Losses and tax-loss harvesting

If you sell an investment for less than you paid, you have a capital loss. You can use capital losses to offset capital gains in the same year. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against your ordinary income in that year. Any remaining loss carries forward to future years.

Some investors use this strategically through a practice called tax-loss harvesting. They deliberately sell losing investments to generate losses that offset gains elsewhere, reducing their overall tax bill. This is legal and common, but it requires careful record-keeping and planning around wash-sale rules, which prevent you from buying a substantially identical investment within 30 days of selling it at a loss.

Frequently Asked Questions

Do I owe capital gains tax if I inherit stocks or property?

Usually no, or very little. Inherited assets receive a "step-up in basis," meaning the cost basis resets to the fair market value on the date of death. If you inherit a house worth $500,000 that the deceased paid $200,000 for, your cost basis is $500,000. If you sell it shortly after for $500,000, you have no gain and owe no tax. This applies to most inherited assets, though some states have their own inheritance taxes.

What if I sell a rental property I own?

Rental properties do not may have access to for the primary residence exemption. You owe capital gains tax on the full profit. However, you can deduct depreciation you claimed on the property over the years you owned it from your cost basis, which reduces your gain. You may also be able to use capital losses from other investments to offset the gain.

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

Yes. The IRS treats cryptocurrency and other digital assets as property. When you sell or trade them for a profit, you owe capital gains tax on that profit. The same long-term versus short-term rules apply. You must report these transactions on your tax return, and exchanges often provide records of your transactions.

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

Yes, and this can be more tax-efficient than selling. If you donate appreciated stock or property directly to a may have access to charity, you avoid the capital gains tax entirely and can deduct the fair market value of the donation as a charitable contribution. You get a deduction without triggering the tax. This works only if you donate the asset itself, not the proceeds from selling it.

What happens if I do not report a capital gain on my tax return?

The IRS receives records from brokers and exchanges about your sales. If you do not report a gain that appears on a Form 1099-B or similar document, the IRS will likely notice and send you a notice of deficiency. You will owe the tax plus interest and potentially penalties. Reporting the gain when you file is the safest approach.