You cannot avoid capital gains tax entirely, but you can reduce what you owe through timing, account type, and holding period

Capital gains tax is owed on the profit you make when you sell an investment for more than you paid for it. You cannot legally eliminate this tax, but the amount you pay depends on choices you make about when you sell, where you hold the investment, and how long you keep it. The difference between short-term and long-term rates can save you thousands of dollars on the same sale.

The IRS taxes short-term capital gains (assets held one year or less) as ordinary income, which means your tax rate could be 10%, 12%, 22%, 24%, 32%, 35%, or 37% depending on your income bracket. Long-term capital gains (assets held more than one year) are taxed at 0%, 15%, or 20% — substantially lower. The simplest legal reduction is often just waiting past the one-year mark before you sell.

Key Takeaways

  • Holding an investment for more than one year before selling cuts your tax rate from your ordinary income bracket to either 0%, 15%, or 20%, depending on your total income.
  • Tax-advantaged accounts like 401(k)s, IRAs, and Roth IRAs let you buy and sell investments inside the account without triggering capital gains tax until you withdraw the money.
  • Harvesting losses — selling investments at a loss to offset gains elsewhere — can reduce your taxable gains by up to $3,000 per year, with unused losses carried forward indefinitely.
  • Gifting appreciated assets to family members or charity can avoid capital gains tax on the appreciation, though the recipient's tax basis changes depending on the situation.
  • Timing large sales across two tax years, donating appreciated securities directly to charity, and using spousal step-up basis at death are all legal strategies with specific rules.

Hold investments for more than one year to may have access to for long-term rates

The single largest tax reduction available to most people costs nothing: waiting. If you sell an investment you have held for exactly one year and one day, your capital gains rate drops from your ordinary income tax bracket to the long-term rate. For someone in the 24% bracket, that means paying 15% instead — a 37% reduction in tax owed on that gain.

The holding period is measured from the date you purchased the asset to the date you sell it. If you bought stock on March 15, 2023, you can sell it on March 16, 2024, and may have access to for long-term treatment. If you sell on March 15, 2024, it is still short-term. The IRS counts the purchase date as day zero.

This strategy works best when you are close to the one-year mark and do not need the money when ready. If you bought an investment at $10,000 and it is now worth $15,000, waiting three months to sell saves you roughly $1,500 in taxes (the difference between 24% and 15% on the $5,000 gain) if you are in the 24% bracket. The investment could drop in value during that time, but the tax savings often outweigh the risk for volatile assets you were planning to sell anyway.

Use tax-advantaged accounts to avoid capital gains tax on trades inside the account

A 401(k), traditional IRA, or Roth IRA lets you buy and sell investments without paying capital gains tax on the trades themselves. You can buy a stock fund for $10,000, sell it for $15,000, and buy a different fund with the $15,000 — all without triggering any tax on the $5,000 gain.

The catch is that you cannot access the money without penalties until you reach age 59½ (with some exceptions). A 401(k) is offered through your employer and may include matching contributions. A traditional IRA you open yourself reduces your taxable income in the year you contribute, but you pay ordinary income tax on withdrawals. A Roth IRA you fund with after-tax dollars, and withdrawals in retirement are tax-free if you follow the rules.

If you are an active trader or frequently rebalance your portfolio, moving that activity into a Roth IRA is one of the most powerful tax moves available. You can trade as much as you want inside the account, and the gains are never taxed. The annual contribution limit is $7,000 (or $8,000 if you are 50 or older), so this works best for people who are not moving large sums of money.

Harvest losses 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 against gains elsewhere. If you sold a stock fund for a $5,000 gain and a bond fund for a $3,000 loss in the same year, you owe tax on only $2,000 of gain. The $3,000 loss offsets the $3,000 of the gain.

You can use losses to offset gains dollar-for-dollar. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against ordinary income in that year. Any remaining loss carries forward to future years with no expiration date. Someone who harvests a $10,000 loss but has only $4,000 of gains can deduct $3,000 against other income this year and carry the remaining $3,000 forward to use next year.

The main restriction is the wash-sale rule: if you sell a security at a loss, you cannot buy the same security (or a substantially identical one) within 30 days before or after the sale, or the loss is disallowed. You can sell a total stock market index fund at a loss and when ready buy a different total stock market index fund, and the loss counts. You cannot sell it and buy the same fund back within the window.

Gift or donate appreciated assets instead of selling them

When you give an appreciated investment to a family member, they receive it at its current value — not what you paid for it. If you bought stock for $10,000 and it is now worth $15,000, you can gift it to your adult child, and they inherit a cost basis of $15,000. If they sell it the next day for $15,000, they owe no tax.

You can give up to $18,000 per person per year (in 2024) without filing a gift tax return or using your lifetime exemption. Married couples can give $36,000 per person. These limits change annually. Gifts above the limit do not trigger when ready tax but reduce your lifetime exemption for estate tax purposes.

Donating appreciated securities directly to a charity is often better than selling and donating the proceeds. You avoid the capital gains tax entirely and receive a charitable deduction for the full current value. If you own stock worth $15,000 that you paid $10,000 for, you can donate it to a may have access to charity, deduct $15,000 on your taxes, and the charity receives $15,000 — nobody pays tax on the $5,000 gain. This works only if you itemize deductions on your tax return.

Spread large sales across two tax years to stay in a lower bracket

Your capital gains tax rate depends partly on your total income for the year. The 0% long-term rate applies to income below a certain threshold ($47,025 for single filers in 2024, though this changes yearly). The 15% rate applies to income above that but below a higher threshold ($518,900 for single filers in 2024). If a large sale would push you into the 20% bracket, selling part of it in December and part in January might keep you in the 15% bracket both years.

This strategy requires planning and coordination with your tax preparer, because the thresholds change yearly and depend on your other income. It works best when you have control over the timing — selling a business stake, real estate, or inherited securities where you are not under pressure to close by a specific date.

The same logic applies to managing your income to stay below the threshold for the 0% rate. If you are retired and have low income, selling appreciated assets in years when your income is below the threshold means paying 0% tax on the gain. Once you start taking Social Security or required minimum distributions, your income rises and the 0% rate may no longer be available.

Understand the step-up in basis at death

When you inherit an investment, your cost basis becomes its value on the date of death, not what the original owner paid for it. If your parent bought stock for $10,000 and it is worth $100,000 when they die, you inherit it with a basis of $100,000. If you sell it when ready for $100,000, you owe no capital gains tax.

This is called a step-up in basis and applies to most inherited assets — stocks, bonds, real estate, and mutual funds. It does not explore to retirement accounts like IRAs or 401(k)s, which have their own rules. The step-up happens automatically; you do not need to do anything to claim it.

This is not a strategy you can use yourself, but it is important to understand for planning purposes. If you have highly appreciated assets and expect to pass them to heirs, holding them until death avoids capital gains tax entirely. This works only if your estate is below the federal estate tax threshold (which is very high — $13.61 million per person in 2024) and your state does not have its own estate tax.

Frequently Asked Questions

Can I avoid capital gains tax by not selling?

Yes, but only temporarily. You owe no tax on unrealized gains — the profit you have not yet locked in by selling. Once you sell, the tax is owed. If you hold an investment until you die, your heirs receive a step-up in basis and avoid the tax entirely, but you cannot use this strategy for yourself.

What if I sell at a loss — can I use that loss forever?

Losses never expire. If you harvest a $10,000 loss but have only $4,000 of gains, you deduct $3,000 against ordinary income this year and carry the remaining $3,000 forward indefinitely. You can use it in any future year when you have gains or income to offset.

Do I have to pay capital gains tax on inherited investments?

No, not on the inherited amount. You receive a step-up in basis to the value on the date of death. You owe tax only on gains that occur after you inherit it, if you sell it later for more than it was worth when you received it.

Can I gift appreciated stock to avoid the tax?

The person who receives the gift does not owe tax on it, but they inherit your original cost basis. If you paid $10,000 and it is worth $15,000 when you gift it, they owe tax on the $5,000 gain if they sell it. Gifting does not eliminate the tax; it shifts the responsibility to the recipient.

Is donating stock to charity better than selling and donating the money?

Yes, if you itemize deductions. You avoid capital gains tax on the appreciation and deduct the full current value. If you sell first, you pay capital gains tax on the gain, then donate the after-tax proceeds. The charity receives less money and you pay more tax.