What you can actually do about capital gains tax

You cannot avoid capital gains tax entirely if you sell an asset at a profit — the tax is owed when you realize the gain. But you can reduce the amount you owe through timing, account type, and specific transactions the tax code allows. The strategies that work depend on whether your gains are short-term (assets held under one year) or long-term (over one year), your income level, and what you own.

The most common legal approaches are holding assets longer to may have access to for lower long-term rates, using tax-advantaged accounts like IRAs or 401(k)s, harvesting losses to offset gains, and donating appreciated assets to charity instead of selling them. Each has different rules and dollar limits. None of these eliminate the tax; they shift when you pay it, reduce the amount, or move the gain into a tax-free account.

Key Takeaways

  • Long-term capital gains (assets held over one year) are taxed at 0%, 15%, or 20% depending on income, while short-term gains are taxed as ordinary income, so holding longer usually saves money.
  • Selling losses to offset gains — called tax-loss harvesting — can reduce your taxable gain dollar-for-dollar, though you cannot buy back the same security within 30 days before or after the sale.
  • Investments inside IRAs, 401(k)s, and other retirement accounts grow without triggering capital gains tax until you withdraw, and some accounts (Roth IRAs, Roth 401(k)s) never tax the gains at all.
  • Donating appreciated stock or real estate to charity avoids the capital gains tax on the donation and gives you a charitable deduction, but you must own the asset over one year.
  • Timing matters: selling in a year when your income is lower, or spreading sales across two tax years, can move you into a lower tax bracket and reduce your rate.

Holding assets longer to reach long-term rates

The single largest tax difference is between short-term and long-term capital gains. If you hold an asset for more than one year before selling, your gain is taxed at the long-term rate: 0%, 15%, or 20% depending on your total income. If you sell within one year, the gain is taxed as ordinary income — the same rate as wages — which can be as high as 37% federally.

The one-year clock starts the day after you buy. If you bought stock on March 15, 2023, you can sell it on March 15, 2024 or later and may have access to for long-term rates. Selling on March 14, 2024 triggers short-term rates. For most people, waiting the extra time saves thousands of dollars on large gains.

This strategy works only if you can afford to hold. If you need the money sooner or the asset is falling in value, waiting may not be practical. But if you have flexibility, the tax savings alone often justify the delay.

Using tax-loss harvesting to offset gains

Tax-loss harvesting means selling an investment at a loss to offset gains you have realized elsewhere. If you sold stock for a $10,000 gain and also own a mutual fund down $3,000, you can sell the fund at the loss. The $3,000 loss cancels $3,000 of the $10,000 gain, leaving you with $7,000 in taxable gains instead of $10,000.

Losses can also offset ordinary income — up to $3,000 per year. If you have no gains to offset, you can use losses to reduce your taxable income by up to $3,000. Any losses beyond that carry forward to future years, so they are not wasted.

The catch is the wash-sale rule. You cannot buy back the same security (or a substantially identical one) within 30 days before or 30 days after the sale. If you do, the loss is disallowed and added back to your basis. You can buy a similar but different fund or stock immediately — for example, selling one S&P 500 index fund and buying a different one — but not the exact same holding.

Keeping gains inside retirement accounts

Money inside a traditional IRA, 401(k), or similar retirement account grows without triggering capital gains tax each year. You can buy and sell investments inside the account, and no tax is due until you withdraw the money in retirement. At that point, the entire withdrawal is taxed as ordinary income, but you have had decades of tax-free growth.

Roth IRAs and Roth 401(k)s go further: the gains are never taxed, even in retirement. You pay tax on the money going in (or on the conversion, if you move money from a traditional account), but all growth and withdrawals are tax-free. The annual contribution limit for IRAs is $7,000 (or $8,000 if you are 50 or older) as of 2024, and 401(k) limits are higher. These limits vary by year.

If you have already maxed out retirement accounts, a regular taxable brokerage account is your only option for new investments, but the retirement account strategy is powerful for money you can set aside long-term.

Donating appreciated assets to charity

If you own stock, real estate, or other assets that have gained value and you want to give to charity, donating the asset itself — rather than selling it and donating the proceeds — avoids the capital gains tax entirely. You get a charitable deduction for the full current value, and the charity receives the asset tax-free.

Example: You bought stock for $5,000 that is now worth $20,000. If you sell it, you owe capital gains tax on the $15,000 gain. If you donate it directly to a may have access to charity, you deduct the full $20,000 and pay zero capital gains tax. The charity can sell it without tax consequences.

The asset must be held over one year to may have access to. You also need a written appraisal for real estate or other non-publicly-traded property, and the charity must be a may have access to organization (most 501(c)(3) nonprofits may have access to). Donor-advised funds are a common vehicle for this strategy — you donate the asset, take the deduction immediately, and recommend grants to charities over time.

Timing sales across tax years or lower-income years

Long-term capital gains are taxed at 0%, 15%, or 20% based on your total taxable income for the year. If you are in a lower tax bracket in one year than another, selling in the lower-income year means a lower rate on the same gain. This matters most when you have control over when income arrives — for example, if you are self-employed, retired, or between jobs.

You can also split a large sale across two calendar years if the timing works. Selling half the shares in December and half in January spreads the gain and may keep you in a lower bracket both years rather than jumping into a higher one in a single year.

This strategy requires planning and often works best with a tax professional, because other income (wages, dividends, retirement withdrawals) also affects your bracket. But the potential savings can be substantial on large gains.

Using stepped-up basis for inherited assets

When you inherit an asset, its tax basis is "stepped up" to its value on the date of death. If your parent bought stock for $10,000 and it was worth $50,000 when they died, your basis is $50,000. If you sell it immediately for $50,000, you owe zero capital gains tax on the $40,000 gain that occurred during their lifetime.

This is one of the largest capital gains tax breaks available, but it applies only to inherited assets, not gifts. If your parent gave you the stock while alive, you inherit their original $10,000 basis. The stepped-up basis rule has been subject to legislative proposals to change or eliminate it, so the rules may differ in future years.

Frequently Asked Questions

Can I avoid capital gains tax by not selling?

Yes. Capital gains tax is owed only when you sell and realize the gain. If you hold an asset indefinitely, no tax is due during your lifetime. However, if you pass it to heirs, they receive a stepped-up basis and can sell without owing tax on your gains. This is not a strategy most people can use if they need the money, but it is the only way to truly avoid the tax.

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

Yes. Losses offset gains dollar-for-dollar. If you have no gains, you can deduct up to $3,000 of losses against ordinary income each year. Losses beyond that carry forward indefinitely to future years. The wash-sale rule prevents you from buying back the same security within 30 days, but you can buy a similar investment immediately.

Do I have to pay capital gains tax on my primary home?

No, if you meet the requirements. You can exclude up to $250,000 of gain ($500,000 if married filing jointly) on the sale of a home you owned and lived in for at least two of the last five years. This exclusion is available once every two years.

Can I reduce capital gains by giving assets to family members?

Giving assets to family does not reduce capital gains tax — the recipient inherits your tax basis, so they owe the same tax if they sell. However, if you wait and pass the asset through your estate, heirs receive a stepped-up basis and can sell without owing tax on your gains. Gifts are useful for other reasons but not for avoiding capital gains tax.

What is the difference between capital gains tax and income tax?

Capital gains tax applies only to profits from selling assets. Income tax applies to wages, salary, and other ordinary income. Long-term capital gains are taxed at lower rates (0%, 15%, or 20%) than ordinary income (up to 37%). Short-term capital gains are taxed as ordinary income at your regular rate.