What capital gains tax is and when you owe it

Capital gains tax is what you pay on profit when you sell an asset for more than you paid for it. If you bought stock for $5,000 and sold it for $8,000, that $3,000 difference is your capital gain. The IRS taxes that profit at rates that depend on how long you held the asset and how much total income you made that year.

You do not owe capital gains tax on assets you still own, only on the ones you sell. This is why timing matters: you can control when you trigger the tax by choosing when to sell. You also do not owe tax on assets passed to heirs after your death—they receive what is called a stepped-up basis, meaning their cost basis resets to the asset's value on the date of death, erasing any gains that built up during your lifetime.

Key Takeaways

  • Long-term capital gains (assets held over one year) are taxed at lower rates than short-term gains, so holding assets longer can reduce your tax bill.
  • You can offset capital gains by selling investments at a loss in the same year, a strategy called tax-loss harvesting.
  • Donating appreciated assets to charity lets you avoid the capital gains tax entirely while claiming a deduction for the full current value.
  • Holding assets until death passes them to heirs with a stepped-up basis, eliminating the tax on gains that occurred during your lifetime.
  • Certain accounts like 401(k)s and IRAs shelter capital gains from tax as long as the money stays in the account.

Hold assets for more than one year to pay lower tax rates

The IRS taxes capital gains at two different rates depending on how long you owned the asset. Short-term capital gains—on assets you held for one year or less—are taxed as ordinary income at your regular tax bracket, which can be as high as 37 percent. Long-term capital gains—on assets held longer than one year—are taxed at 0, 15, or 20 percent depending on your income level, which is substantially lower for most people.

This means if you are thinking about selling an investment, waiting until you have held it for more than one year can cut your tax bill significantly. If you bought a stock in November and are thinking of selling in October of the next year, waiting two more months puts you into long-term territory. The difference in tax rate can be worth thousands of dollars on a large gain.

The one-year clock starts the day after you buy the asset. If you bought on January 15, you can sell on January 15 of the next year and may have access to for long-term rates. Brokerages track this automatically and will label your gains as short-term or long-term when you sell.

Sell losing investments to offset gains in the same year

Tax-loss harvesting means selling an investment that has lost value to create a loss you can use to cancel out gains from other sales. If you sold one stock for a $5,000 gain and another for a $3,000 loss in the same calendar year, you only owe tax on the net $2,000 gain.

You can harvest losses throughout the year whenever you notice an investment is underwater. Many people do this in December to offset gains they realized earlier in the 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, and carry any remaining losses forward to future years.

One important rule: if you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale, the IRS disallows the loss. This is called the wash-sale rule. You can avoid it by buying a different but similar investment—for example, selling one S&P 500 index fund and buying a different one—and then switching back after 30 days if you want to.

Donate appreciated assets directly to charity instead of selling them

If you own stock, real estate, or another asset that has appreciated significantly, donating it directly to a may have access to charity lets you avoid the capital gains tax entirely. You also get to deduct the full current market value of the asset as a charitable contribution on your tax return, which can lower your income tax.

This works because the charity receives the asset tax-free, and you never trigger the capital gains tax by selling it. You get the benefit of both: no capital gains tax and a deduction for the full appreciated value. If you had sold the asset first and then donated the proceeds, you would have paid capital gains tax on the gain, leaving less money to donate.

You must donate to a may have access to charitable organization—the IRS website has a searchable database of may be able to access charities. You will need a written appraisal for real estate or other hard-to-value assets, and you must file Form 8283 with your tax return to document the donation. For stocks and mutual funds, your broker can transfer them directly to the charity's account.

Use tax-advantaged retirement and investment accounts

Money inside a 401(k), traditional IRA, or Roth IRA grows without triggering capital gains tax each year. You can buy and sell investments within these accounts as often as you want, and the gains are sheltered from tax as long as the money stays in the account. This lets your investments compound faster because you are not paying tax on gains every year.

In a traditional 401(k) or IRA, you pay tax when you withdraw the money in retirement. In a Roth IRA, you pay no tax on withdrawals at all, as long as you follow the rules. A 529 college savings plan works the same way for education expenses: gains are tax-free as long as you use the money for may have access to education costs.

If you have money to invest and want to avoid capital gains tax, maxing out contributions to these accounts should be your first move. The annual contribution limits are set by the IRS and change each year, so check the current limits on the IRS website.

Hold assets until death to pass them with a stepped-up basis

When you die, your heirs inherit your assets at their market value on the date of your death. This is called a stepped-up basis. If you bought stock for $10,000 and it was worth $50,000 when you died, your heirs inherit it with a cost basis of $50,000. If they sell it the next day for $50,000, they owe zero capital gains tax because there is no gain.

This means all the appreciation that happened during your lifetime is erased from a tax perspective. Your heirs can sell inherited assets when ready and owe no tax, or hold them and only pay tax on gains that happen after they inherit. This is one of the largest tax breaks available, and it applies to all assets—stocks, real estate, art, collectibles, everything.

The stepped-up basis applies to assets in your taxable estate. Assets you have already transferred to a trust or given away during your lifetime do not receive this benefit. If you are thinking about large gifts to heirs, talk to an estate attorney or tax professional about whether holding the assets until death makes more sense from a tax perspective.

Understand the net investment income tax on high earners

If your modified adjusted gross income exceeds certain thresholds—$200,000 for single filers and $250,000 for married couples filing jointly—you may owe an additional 3.8 percent net investment income tax on top of your regular capital gains tax. This tax applies to capital gains, dividends, interest, and rental income.

This is a separate tax from the capital gains tax itself, so a high earner could pay 20 percent capital gains tax plus 3.8 percent net investment income tax on the same gain. The thresholds have not changed since 2013, so more people are affected each year as incomes rise. If you are close to these thresholds, timing the sale of large gains across multiple years can help you stay below the limit in some years.

Frequently Asked Questions

Can I avoid capital gains tax by reinvesting the money?

No. The tax is owed the year you sell the asset, regardless of what you do with the proceeds. Reinvesting the money does not defer or eliminate the tax. However, if you reinvest in a tax-advantaged account like an IRA or 401(k), future gains on that new money will be sheltered from tax.

What if I sell an asset at a loss—can I use that to reduce my taxes?

Yes, through tax-loss harvesting. You can use losses to offset gains in the same year, and if losses exceed gains, you can deduct up to $3,000 against your ordinary income. Losses beyond that carry forward to future years. Just remember the wash-sale rule: you cannot buy the same or substantially identical security within 30 days.

Do I owe capital gains tax on inherited assets?

No, not on the inherited value itself. Your heirs receive a stepped-up basis, so they only owe tax on gains that happen after they inherit. If they sell inherited stock when ready, they owe nothing, even if it had appreciated for decades before your death.

What is the difference between short-term and long-term capital gains rates?

Short-term gains (assets held one year or less) are taxed as ordinary income at rates up to 37 percent. Long-term gains (held over one year) are taxed at 0, 15, or 20 percent depending on your income. For most people, long-term rates are significantly lower, so timing the sale to cross the one-year threshold can save thousands.

Should I talk to a tax professional before selling a large investment?

Yes. A tax professional or CPA can model the tax impact of selling in different years, identify tax-loss harvesting opportunities, and help you structure charitable donations of appreciated assets. The cost of professional information often pays for itself through tax savings on large transactions.