What you can actually do about capital gains tax
You cannot avoid capital gains tax on stocks you sell at a profit — the tax is owed when you realize the gain. What you can do is reduce the amount of gain you report, defer when you pay, or use losses to offset gains. The difference between these three strategies matters, because some lower your tax bill permanently while others just push it to a later year.
The IRS taxes capital gains differently depending on how long you held the stock. If you sold within one year, you pay short-term capital gains tax at your ordinary income tax rate. If you held for more than one year, you pay long-term capital gains tax, which is lower — 0%, 15%, or 20% depending on your income. This timing difference alone can save thousands of dollars.
Key Takeaways
- Holding stocks for more than one year before selling triggers long-term capital gains rates, which are significantly lower than short-term rates for most people.
- Harvesting losses — selling stocks at a loss to offset gains elsewhere in your portfolio — can reduce your taxable gain dollar-for-dollar in the same year.
- Donating appreciated stocks to charity avoids the capital gains tax entirely and gives you a charitable deduction for the full current value.
- Holding stocks until death resets the cost basis to the current market price, so your heirs owe no tax on the gain that accumulated during your lifetime.
- The wash-sale rule blocks you from claiming a loss if you buy the same or substantially identical stock within 30 days before or after the sale.
Hold stocks longer than one year to pay lower tax rates
The simplest reduction is time. If you sell a stock you have owned for more than one year, the gain is taxed as a long-term capital gain. For most people, this rate is 15%. If you sell within one year, it is taxed as a short-term capital gain at your ordinary income tax rate, which can be 22%, 24%, 32%, 35%, or 37% depending on your income bracket.
The difference is real money. Suppose you bought a stock for $10,000 and sold it for $15,000, a $5,000 gain. If you are in the 24% tax bracket and sell within one year, you owe $1,200 in tax. If you hold for 13 months and sell, you owe $750 (15% of $5,000). That is $450 in tax savings by waiting.
This strategy works only if you can afford to wait. If you need the money now or believe the stock will fall, holding longer is not an option. But if you are selling for rebalancing or other reasons and the stock has already gained, delaying the sale by a few weeks or months until you cross the one-year mark can meaningfully reduce your tax bill.
Use tax-loss harvesting to offset gains in the same year
Tax-loss harvesting means selling a stock at a loss to offset capital gains you have realized elsewhere. If you sold Stock A for a $5,000 gain and Stock B for a $3,000 loss, you report a net gain of $2,000 and pay tax only on that amount. The loss reduces your taxable gain dollar-for-dollar.
This is a real reduction, not a deferral. You are using an actual loss to shrink the gain you owe tax on. Many investors do this in December, reviewing their portfolio for positions that have declined and selling them specifically to offset gains from earlier in the year.
The catch is the wash-sale rule. If you sell a stock at a loss, you cannot buy the same stock or a substantially identical one within 30 days before the sale or 30 days after it. If you do, the IRS disallows the loss. You can buy a different stock in the same sector or a similar fund to keep your portfolio positioned the way you want while the 30-day window closes.
Donate appreciated stocks to charity instead of selling
If you own a stock that has gained significantly and you want to give money to charity, donating the stock itself avoids the capital gains tax entirely. You get a charitable deduction for the full current market value of the stock, and the charity receives it without you having to pay tax on the gain.
This works because when you donate appreciated securities directly to a may have access to charity, you never "realize" the gain — you never sell it and pocket the proceeds. The charity can sell it tax-free. You benefit twice: no capital gains tax, and a deduction for the full value of the donation.
You must donate to a may have access to charitable organization — the IRS website has a search tool to verify. You cannot donate to an individual or a political campaign. You will need a written appraisal of the stock's value on the date of donation to claim the deduction on your tax return.
Hold stocks until death to reset the cost basis
If you never sell a stock during your lifetime, your heirs inherit it at a stepped-up basis. This means the cost basis — the price used to calculate gain or loss — resets to the market value on the date of your death. Any gain that accumulated while you owned it is never taxed.
Suppose you bought a stock for $10,000 and it is worth $50,000 when you die. Your heirs inherit it with a cost basis of $50,000. If they sell it the next day for $50,000, they owe no tax. The $40,000 gain that happened on your watch disappears.
This is a permanent tax avoidance, not a deferral. The downside is that you must hold the stock until death — you cannot access the gain during your lifetime without triggering the tax. This strategy makes sense for stocks you do not need to sell and believe will continue to appreciate, or for wealth you intend to pass to heirs anyway.
Use tax-advantaged accounts to avoid capital gains tax altogether
Inside a traditional IRA, Roth IRA, or 401(k), you can buy and sell stocks without triggering capital gains tax. The gains are sheltered from tax until you withdraw the money (or never, in the case of a Roth).
This is the most powerful tool available, but it has limits. You can only contribute a certain amount per year — $7,000 for an IRA in 2024, or $23,500 for a 401(k). If you have already maxed out these accounts, you cannot use them to shelter additional stock gains.
A 529 education savings plan also shelters capital gains if the money is used for may have access to education expenses. A Health Savings Account (HSA) shelters gains if used for medical expenses. These accounts are narrow in scope but powerful if they fit your situation.
Spread sales across multiple years to stay in a lower tax bracket
Your capital gains tax rate depends partly on your income. If you have a large gain and realize it all in one year, it might push you into a higher tax bracket. If you can spread the sale across two years, you might stay in the 15% bracket instead of jumping to 20%.
This requires planning ahead. You might sell half the position in December of one year and half in January of the next. Or you might use a installment sale, where the buyer pays you over time and you report the gain as payments arrive, spreading the income across multiple years.
Installment sales are complex and require a promissory note. They work best when you are selling to a related party or a business you control. For most stock sales, spreading across calendar years is simpler: sell some shares before year-end and the rest after January 1st.
Frequently Asked Questions
Can I sell a stock at a loss and buy it back right away?
No. The wash-sale rule prevents you from claiming the loss if you buy the same stock within 30 days before or after the sale. You can buy a similar but not identical stock — for example, a different company in the same industry or a sector ETF — and then buy back the original stock after 30 days.
Do I have to pay capital gains tax if I reinvest the money?
Yes. The tax is owed when you sell, regardless of what you do with the proceeds. Reinvesting does not defer or reduce the tax. However, if you reinvest inside a tax-advantaged account like an IRA or 401(k), future gains on that reinvested money are sheltered.
What if I sell at a loss — can I use that loss forever?
You can use losses to offset gains in the current year and future years. If your losses exceed your gains, you can deduct up to $3,000 of the excess loss against ordinary income in a single year. Any remaining loss carries forward to future years indefinitely.
Does the long-term capital gains rate explore to all stocks?
Yes, as long as you held the stock for more than one year. The rate is 0%, 15%, or 20% depending on your total income. Some collectibles and real estate have different rules, but ordinary stocks follow the standard long-term rate.
If I inherit stocks, do I owe capital gains tax?
No. You inherit at a stepped-up basis, meaning the cost basis resets to the market value on the date of death. You owe no tax on the gain that accumulated before you inherited it. If you sell after inheriting, you owe tax only on any gain that happens after the inheritance date.