How to Avoid Capital Gains Tax (Legally) in 2026
Capital gains tax is often one of the largest avoidable taxes. Unlike payroll taxes that are automatically withheld, capital gains are often discretionary — you control when you sell, what you sell, how much you give away, and where you reinvest. The strategies on this page are all legal, IRS-compliant, and used by savvy investors every year to significantly reduce what they owe.
Quick reference: all 8 strategies
| # | Strategy | Best For | Potential Savings |
|---|---|---|---|
| 1 | Hold over 1 year (long-term rates) | Anyone within 1 year of holding | 7–17% of gain |
| 2 | 0% bracket harvesting | Lower-income / semi-retired | Up to 15% of gain |
| 3 | Tax-loss harvesting | Diversified portfolios | Dollar-for-dollar offset |
| 4 | Primary home exclusion | Homeowners | Up to $75,000+ saved |
| 5 | Donate appreciated stock | Charitable givers | 15–23.8% on donated portion |
| 6 | Tax-advantaged accounts | Long-term savers | 100% of internal gains |
| 7 | 1031 exchange (real estate) | Real estate investors | 100% deferral |
| 8 | Hold until death (step-up) | Large inherited estates | 100% permanent elimination |
1 Hold for more than one year
The single most universally applicable strategy. Hold any investment for more than 365 days and your gain qualifies for long-term capital gains rates (0%, 15%, or 20%) instead of your ordinary income rate (10%–37%). The difference is often dramatic:
- Moderate earner ($80k income), $50k gain: short-term 22% = $11,000 tax vs. long-term 15% = $7,500. Saves $3,500 by waiting one extra day past the 1-year mark.
- High earner ($250k income), $100k gain: short-term 35% = $35,000 vs. long-term 15% = $15,000. Saves $20,000.
This sounds obvious, but thousands of investors sell a day or week before the one-year mark without realizing the cost. Calendar your purchase dates and set a reminder 3 months ahead of the 1-year milestone.
2 Harvest gains in the 0% bracket
In 2026, taxpayers with taxable income under $49,450 (single) or $98,900 (MFJ) pay exactly 0% federal tax on long-term capital gains. These thresholds are after all deductions — including the standard deduction of $15,000 (single) or $30,000 (MFJ).
This means a single person can have up to $64,450 in total income (before the standard deduction) and owe nothing on long-term gains. A married couple can have up to $128,900.
When this applies
- Early retirement: Living primarily off investments before drawing Social Security
- Sabbaticals or career transitions: Lower-income years between jobs
- Students with inherited portfolios: Low earned income but inherited appreciated assets
- Business owners in lean years: Volatile income that dips below the threshold some years
0% bracket gain harvesting — the "reset" strategy
If you have appreciated positions you plan to keep long-term, you can sell them in a 0% bracket year and immediately repurchase them (the wash-sale rule does not apply to gains, only losses). This resets your cost basis to the current price — permanently reducing future gains. If the stock later doubles, you will owe tax only on the appreciation above your new higher basis.
3 Tax-loss harvesting
Capital losses directly offset capital gains dollar-for-dollar. By strategically selling underperforming positions to realize losses, you can reduce or eliminate the tax on gains elsewhere in your portfolio.
The mechanics
- Short-term losses first offset short-term gains (higher-rate), then long-term gains
- Long-term losses first offset long-term gains, then short-term gains
- Net remaining losses (up to $3,000/year) offset ordinary income
- Excess carries forward indefinitely to future years
Wash-sale caution
You cannot repurchase the same or substantially identical security within 30 days before or after the sale. To stay invested in a sector, sell one fund and buy a different (but similar) fund. For example: sell your S&P 500 fund and buy a total market fund. The exposure is similar; the securities are different.
How much it saves
On a $50,000 gain offset by $50,000 in harvested losses: savings of $7,500 at 15% federal rate, or $13,000 at the combined 15% + 3.8% NIIT + 5% state rate for a typical mid-rate state resident.
4 The primary home exclusion
If you sell your primary residence and have lived in it for at least 2 of the last 5 years, you can exclude up to $250,000 of gain (single) or $500,000 (MFJ) completely from federal capital gains tax. See the full real estate guide for details, qualifications, and worked examples.
On a $500,000 gain for a married couple: $0 federal tax (with full exclusion). Without the exclusion and in the 20% bracket: $100,000 tax bill. The exclusion is one of the most valuable tax breaks in the entire tax code.
5 Donate appreciated stock to charity
Instead of selling appreciated stock and donating cash, donate the stock directly to a qualified charity or a Donor-Advised Fund (DAF). The benefits are substantial:
- You avoid capital gains tax entirely on the donated portion
- You get a charitable deduction for the full fair market value (up to 30% of AGI for public charities; excess carries forward 5 years)
- The charity (a tax-exempt organization) sells the stock with no tax liability
The math
You own Apple stock purchased at $5,000 now worth $55,000 (a $50,000 gain). You plan to donate $55,000 to charity.
- If you sell first, then donate cash: Capital gains tax on $50,000 at 15% = $7,500. Donation of $55,000 cash generates deduction of $55,000. Net: you paid $7,500 in tax, donated $55,000.
- If you donate the stock directly: $0 capital gains tax. Donation of $55,000 generates deduction of $55,000. Net: you paid $0 in capital gains tax, donated $55,000 at full value.
Saving: $7,500 in federal tax — plus whatever state tax would have applied on the $50,000 gain. A DAF lets you take the deduction in a high-income year while distributing grants to charities over many years.
6 Use tax-advantaged accounts
Assets held inside these account types are fully sheltered from capital gains tax:
| Account Type | Tax Treatment of Gains | 2026 Contribution Limit |
|---|---|---|
| Roth IRA | Tax-free growth and withdrawal | $7,000 ($8,000 if 50+) |
| Traditional IRA | Tax-deferred (taxed as ordinary income on withdrawal) | $7,000 ($8,000 if 50+) |
| 401(k) / 403(b) | Tax-deferred (traditional) or tax-free (Roth 401k) | $23,500 ($31,000 if 50+) |
| HSA | Triple tax-free (if used for medical expenses) | $4,300 (self) / $8,550 (family) |
| 529 Plan | Tax-free growth and withdrawal for education | No annual federal limit |
Selling a stock that doubled within a Roth IRA costs you nothing. The same sale in a taxable account costs 15–23.8% in federal tax plus state. Every dollar of net investment income that you keep in tax-advantaged accounts is permanently protected.
Roth conversions to reduce future capital gains exposure
Converting a traditional IRA to a Roth IRA in low-income years accelerates ordinary income tax now (at current lower rates) but ensures future gains and withdrawals are completely tax-free. This is especially powerful in early retirement years before Social Security begins.
7 1031 exchange for investment real estate
When selling investment real estate, a Section 1031 like-kind exchange allows you to defer 100% of capital gains tax — including depreciation recapture — by rolling proceeds into a replacement property within 180 days. See the full real estate guide for rules, timelines, and examples.
The deferral is indefinitely renewable — each new exchange continues it. If you eventually hold the replacement property until death, your heirs get a stepped-up basis and the accumulated deferred tax is permanently eliminated.
8 Hold appreciated assets until death
Under current law, assets transferred at death receive a stepped-up cost basis equal to fair market value on the date of death. All embedded capital gains accumulated during the decedent's lifetime are permanently forgiven — they are never taxed.
For very large, highly appreciated positions (founder stock, inherited real estate, long-held index funds), holding until death can save tens or hundreds of thousands in capital gains tax. Estate tax may apply separately, but for most estates below the $13.99 million (2026) federal exemption, this is a dominant strategy.
Frequently asked questions
Can I put capital gains into a 401k to avoid tax?
No — you cannot contribute capital gains directly to a 401k or IRA. These accounts only accept contributions from earned income (wages, self-employment income). However, maximizing your 401k contributions reduces your ordinary taxable income, which can indirectly move more of your capital gains income into the 0% or 15% bracket.
Does moving to a no-income-tax state avoid capital gains?
Moving to a state with no income tax (Florida, Texas, Nevada, etc.) before selling eliminates state capital gains tax. However, you must establish genuine domicile in the new state — keeping a residence, updating driver's license and voter registration, and spending the majority of your time there. Your previous state may audit the timing of your move relative to a large gain, especially California and New York which are aggressive about challenging part-year residency claims.
What is a Qualified Opportunity Zone (QOZ)?
A QOZ is a designated low-income community where investments receive special tax treatment. Reinvesting capital gains into a Qualified Opportunity Fund within 180 days of a sale can: (a) defer the original gain's tax until you exit the fund or December 31, 2026; and (b) permanently exclude any appreciation within the fund from tax if the investment is held at least 10 years. QOZ investing is complex and speculative — some funds have underperformed. The tax benefits are real, but so is the investment risk.
Is it illegal to time asset sales to minimize taxes?
No — timing the sale of assets to minimize taxes is completely legal and widely practiced. The IRS explicitly allows this. Tax avoidance (reducing your tax bill through legal means) is different from tax evasion (illegally hiding income or assets). Every strategy on this page is tax avoidance — encouraged by Congress through the tax code itself.