You cannot avoid capital gains tax entirely, but you can reduce what you owe through timing, account type, and strategy
Capital gains tax is owed when you sell an asset for more than you paid for it. You cannot eliminate this tax by hiding the sale or pretending it did not happen — the IRS requires brokers and mutual fund companies to report sales to them on Form 1099-B. What you can do is structure your sales and investments to lower your tax bill within the law. The main routes are holding assets longer to may have access to for lower rates, using tax-advantaged accounts, offsetting gains with losses, and donating appreciated assets to charity instead of selling them.
The strategy that works best depends on what you own, how long you have owned it, your income level, and whether you have losses to use. This guide covers the real options available to you and which situations each one fits.
Key Takeaways
- Long-term capital gains (assets held over one year) are taxed at 0%, 15%, or 20% depending on your income, while short-term gains are taxed as ordinary income, often at much higher rates.
- Holding an asset for more than one year before selling it can cut your tax rate in half or more, even if you do nothing else.
- Tax-loss harvesting — selling losing investments to offset winning ones — can reduce your taxable gains dollar-for-dollar in the year you sell.
- Donating appreciated stock or mutual funds to a charity lets you avoid the capital gains tax entirely while taking a charitable deduction for the full current value.
- Retirement accounts like 401(k)s and IRAs have no capital gains tax on sales inside the account, though you pay tax on withdrawals later.
Hold assets for more than one year to may have access to for lower tax rates
The single biggest factor in your capital gains tax is how long you owned the asset. If you sell within one year of buying, the gain is short-term capital gains, taxed as ordinary income at your regular tax bracket — potentially 10%, 12%, 22%, 24%, 32%, 35%, or 37% depending on your income. If you hold for more than one year, it becomes long-term capital gains, taxed at 0%, 15%, or 20% depending on your total income for the year.
For most people, the difference is substantial. Someone in the 24% ordinary income bracket pays 24% on a short-term gain but only 15% on a long-term gain — a 37% reduction in tax owed on that gain. Someone in the 35% bracket pays 35% short-term but 20% long-term. The 0% rate applies to long-term gains if your income is below $47,025 (single) or $94,050 (married filing jointly) in 2024, meaning you owe nothing on those gains.
The holding period starts the day after you buy and ends the day you sell. If you bought on January 15 and sold on January 16 of the next year, that counts as more than one year. If you bought on January 15 and sold on January 15 of the next year, it does not — you need to wait until January 16 to may have access to.
Use tax-loss harvesting to offset gains with losses
Tax-loss harvesting means selling an investment that has lost value to create a loss you can use against your gains. If you sold a stock for a $5,000 gain and another stock for a $3,000 loss in the same year, you report a net gain of $2,000 and pay tax only on that $2,000 instead of the full $5,000.
You can harvest losses throughout the year as you notice them. Many people do this in November and December to offset gains realized earlier in the year. The loss can be long-term or short-term — it offsets gains of the same type first, then the other type. If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against ordinary income (like wages), and carry any remaining loss forward to future years.
One rule to watch: the wash-sale rule. If you sell a stock at a loss and buy the same stock (or a substantially identical one) within 30 days before or after the sale, the IRS disallows the loss. You can buy a similar but not identical investment — for example, sell one S&P 500 index fund and buy a different S&P 500 index fund — and the loss still counts. Wait 31 days if you want to buy back the exact same investment.
Donate appreciated assets directly to charity instead of selling
If you own stock, mutual funds, or other investments that have gained value and you want to give to charity, donate the asset itself rather than selling it first. You avoid the capital gains tax entirely, and you get a charitable deduction for the full current market value — not just what you paid for it.
Example: You bought 100 shares of a stock for $2,000 ten years ago. It is now worth $10,000. If you sell it, you owe capital gains tax on the $8,000 gain. If you donate those 100 shares directly to a may have access to charity, you owe no capital gains tax and you can deduct $10,000 on your tax return (subject to the limits on charitable deductions, which vary by your income and the type of charity). You come out ahead by the amount of tax you would have paid.
This works for stocks, mutual funds, exchange-traded funds (ETFs), and bonds held long-term. It does not work for cash — if you donate cash, you get the deduction but there is no capital gains tax to avoid. The charity must be a may have access to organization (most nonprofits, religious organizations, and public charities are; donor-advised funds count, but not political campaigns). You need a written appraisal for donations over $5,000.
Use tax-advantaged retirement accounts to defer or eliminate capital gains tax
Inside a traditional 401(k), IRA, or 403(b), you can buy and sell investments without paying capital gains tax on the gains. If you buy a stock for $1,000 inside an IRA and sell it for $5,000 a month later, there is no tax on that $4,000 gain. The tax comes later, when you withdraw money from the account in retirement.
With a Roth IRA or Roth 401(k), you pay no tax on the gains at all — not when you sell inside the account, and not when you withdraw in retirement. This makes Roth accounts especially valuable if you expect your investments to grow significantly. The tradeoff is that you contribute after-tax dollars (you do not get a deduction when you put money in), and you can only withdraw tax-free after age 59½ and after the account has been open for five years.
The annual contribution limits are $7,000 for IRAs (or $8,000 if you are 50 or older) and $23,500 for 401(k)s (or $31,000 if you are 50 or older) in 2024. If you have earned income, you can open and contribute to an IRA. A 401(k) is offered through your employer.
Spread 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. If a large sale would push you into a higher tax bracket, you might pay less total tax by selling part of the asset in one year and part in the next year, keeping your income lower in each year.
Example: You are single with $40,000 in wages and want to sell a stock with a $30,000 long-term gain. In 2024, the 15% long-term rate applies to income up to $47,025. If you sell all $30,000 this year, your total income is $70,000, and $22,975 of the gain is taxed at 20% instead of 15%. If you sell $7,000 this year and $23,000 next year, you stay in the 15% bracket both years and save about $900 in tax.
This strategy requires planning ahead and works best when you control the timing of the sale. It does not work if you are forced to sell (for example, if you need the money when ready). The tax brackets and income thresholds change each year, so check the current year's rates before deciding.
Gift appreciated assets to family members in lower tax brackets
If you give appreciated stock or other investments to a family member, they do not owe capital gains tax on the gift itself. If they later sell the asset, they owe tax on the gain from the time they received it, not from when you originally bought it. If the asset has not gained value since they received it, they owe no tax at all.
This works best when the recipient is in a lower tax bracket than you or when the asset is unlikely to gain much more value. There is no gift tax on gifts up to $18,000 per person per year (in 2024), so you can give substantial amounts without filing a gift tax return. Gifts to spouses are unlimited.
One important limit: if you give the asset and the recipient sells it within one year, the gain is taxed as short-term capital gains at their ordinary income rate, even if you held it long-term. The holding period does not transfer to the recipient — it resets when they receive the gift.
Understand step-up in basis for inherited assets
When you inherit an investment, its basis (the value used to calculate gain or loss) is stepped up to its market value on the date of death. If your parent bought a stock for $5,000 and it was worth $50,000 when they died, your basis is $50,000. If you sell it when ready for $50,000, you owe no capital gains tax.
This is not a strategy you can use yourself — it applies automatically to assets you inherit. But it is worth understanding because it affects how you should plan your estate. Assets that have large unrealized gains are often better left to heirs than donated to charity during your lifetime, because the heirs get the step-up and owe no tax, while a charity donation gives you only a deduction.
Frequently Asked Questions
Can I avoid capital gains tax by not selling?
Yes, as long as you do not sell. The tax is owed only when you sell or exchange the asset. You can hold appreciated investments indefinitely and owe nothing until you sell. If you pass the asset to heirs, they get a step-up in basis and can sell it tax-free. This is one reason some people hold winning investments for decades.
What if I sell at a loss — can I use that to offset other income?
You can deduct up to $3,000 of net capital losses against ordinary income (wages, salary, interest) in a single year. If your losses exceed $3,000, you carry the excess forward to future years and use it the same way. This is one of the few ways capital losses help you beyond offsetting capital gains.
Does the 0% long-term capital gains rate really mean I owe nothing?
Yes, if your income is low enough to may have access to. In 2024, single filers with taxable income up to $47,025 and married filers up to $94,050 pay 0% on long-term gains. Income above those thresholds is taxed at 15%. This is one reason it can pay to realize gains in years when your income is lower.
If I buy a stock in a Roth IRA and it doubles, do I owe tax when I withdraw it?
No. In a Roth IRA, you owe no tax on withdrawals after age 59½ and after the account has been open for five years, regardless of how much the investments have grown. This makes Roth accounts powerful for long-term investing in growth stocks or other volatile assets.
Can I claim a loss on a stock I bought and never sold?
No. You can only claim a capital loss when you actually sell the asset. If you own a stock that has lost value but you have not sold it, you have an unrealized loss, which does not count for tax purposes. You must sell to realize the loss and use it to offset gains.