How to Avoid Capital Gains Taxes: Exclusions, Exchanges, and Timing

To avoid capital gains taxes, or at least sharply reduce them, you can hold investments longer than a year, sell in a low-income year to hit the 0% bracket, use the home sale exclusion, harvest losses, defer real estate gains through a 1031 exchange, keep trading activity inside a retirement account, donate appreciated assets, or spread a sale across years with an installment contract. Different strategies fit different assets, so the right move depends on what you own and when you plan to sell. For 2026, long-term capital gains are taxed at 0%, 15%, or 20% depending on taxable income, and single filers pay nothing on gains that keep total taxable income at or below $49,450 ($98,900 for married couples filing jointly).

Hold the Asset More Than One Year

Selling within a year of purchase triggers short-term capital gains, taxed at your ordinary income rate, which can reach 37%.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses Cross the one-year mark and the same profit is taxed at long-term rates that top out at 20%. On a large gain, waiting an extra week can be worth thousands of dollars.

For the 2026 tax year, the long-term brackets are:2Internal Revenue Service. Revenue Procedure 2025-32

  • 0% on taxable income up to $49,450 (single), $98,900 (married filing jointly), or $66,200 (head of household).
  • 15% on taxable income above those amounts up to $545,500 (single), $613,700 (joint), or $579,600 (head of household).
  • 20% on taxable income above the 15% thresholds.

Time the Sale for a 0% Year

If your total taxable income for the year, counting the gain itself, lands inside the 0% band, the federal capital gains tax on that sale is zero. This is worth planning around in years when your other income drops: a gap between jobs, a sabbatical, early retirement before Social Security begins, or a year you convert to Roth without much wage income. You can realize gains up to the top of the 0% bracket, reset your cost basis by rebuying (there is no wash sale rule on gains), and pay nothing.

Watch the 3.8% Net Investment Income Tax

Higher earners owe an extra 3.8% surtax on net investment income, capital gains included, once modified adjusted gross income passes $200,000 (single) or $250,000 (joint).3Office of the Law Revision Counsel. 26 U.S. Code 1411 – Imposition of Tax The tax hits the lesser of your net investment income or the amount your MAGI exceeds the threshold. Someone in the 20% long-term bracket paying this surtax faces a combined 23.8% federal rate.

These thresholds do not adjust for inflation, so they capture more households each year. Anything that lowers realized gains in a given year, including loss harvesting or splitting a sale across two tax years, can keep you under the trigger or shrink the portion that is taxed.4Internal Revenue Service. Topic No. 559, Net Investment Income Tax

Use the Home Sale Exclusion

The primary residence exclusion is one of the largest tax breaks in the code. A single filer can exclude up to $250,000 of gain on the sale of a main home, and a married couple filing jointly can exclude up to $500,000.5Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence Any gain above the cap is taxed at the long-term rates covered above.

To qualify, you must have owned the home for at least two years and lived in it as your main home for at least two of the five years before the sale. Those two years of use do not have to be consecutive. You also cannot have used the exclusion on another home sale in the prior two years.5Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence

Partial Exclusion if You Have to Sell Early

If you fall short of the two-year mark because of a job move, a health issue, or another unforeseen event, you can claim a prorated share of the exclusion. For a work-related move, the new workplace generally has to be at least 50 miles farther from the home than the old one. Health-related qualifiers include a doctor-recommended move or care for a sick family member. Unforeseen events cover natural disasters, divorce, death of a co-owner, or job loss.6Internal Revenue Service. Publication 523, Selling Your Home The exclusion scales with how much of the two-year requirement you met: one year in a home would generally let a single filer exclude $125,000.

Rental or Business Use Reduces the Exclusion

If part of your ownership period was non-qualified use, such as renting the home out before moving in, the share of gain tied to that period does not qualify for the exclusion. The disqualified portion is calculated as non-qualified use time divided by total ownership.5Office of the Law Revision Counsel. 26 U.S. Code 121 – Exclusion of Gain From Sale of Principal Residence Non-qualified use before January 1, 2009 does not count against you, and time after you last used the home as your residence is also excluded from the calculation.

Harvest Losses to Offset Gains

Selling losing investments in the same year you take gains lets you cancel the gains out, dollar for dollar. If your losses exceed your gains, up to $3,000 of the extra loss ($1,500 if married filing separately) can be deducted against ordinary income.7Office of the Law Revision Counsel. 26 U.S. Code 1211 – Limitation on Capital Losses Anything left over carries forward to future years with no expiration.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses

The wash sale rule blocks the loss deduction if you buy a substantially identical security within 30 days before or after the sale. The disallowed loss is added to the basis of the replacement shares rather than lost outright.8Office of the Law Revision Counsel. 26 U.S. Code 1091 – Loss From Wash Sales of Stock or Securities To stay invested while claiming the loss, you can buy a different fund that tracks a similar but not identical index, or simply wait out the 30-day window.

As of 2026, the wash sale rule generally does not reach cryptocurrency or other digital assets, so you can sell a coin at a loss and repurchase it immediately without losing the deduction. Congress has considered closing this gap, so the treatment may not last.

Defer Real Estate Gains With a 1031 Exchange

Section 1031 lets you sell investment or business real estate and roll the proceeds into another investment or business property, deferring the entire gain. The rule applies only to real estate held for investment or productive business use. Stocks, bonds, personal property, and real estate held for quick resale do not qualify.9Office of the Law Revision Counsel. 26 U.S. Code 1031 – Exchange of Real Property Held for Productive Use or Investment

Two deadlines are strict. You must identify the replacement property in writing within 45 days of transferring the original, and close on it within 180 days of that transfer or by your tax return due date (with extensions), whichever is earlier.9Office of the Law Revision Counsel. 26 U.S. Code 1031 – Exchange of Real Property Held for Productive Use or Investment Miss either one and the full gain becomes taxable.

A qualified intermediary holds the proceeds during the exchange window; taking the money yourself disqualifies the transaction. Both properties must be in the United States. Some investors chain 1031 exchanges for decades and then leave the final property to heirs, who get a stepped-up basis and wipe out the deferred gain entirely.

Trade Inside a Tax-Advantaged Account

Buying and selling inside a 401(k), IRA, or HSA does not create a taxable event. You can rebalance, switch funds, or reinvest dividends without owing capital gains tax on any of it. Tax treatment then depends on the account type: traditional 401(k)s and IRAs defer tax until you take distributions in retirement, when withdrawals are taxed as ordinary income; Roth 401(k)s and Roth IRAs are funded with after-tax dollars but produce tax-free qualified withdrawals, growth included; and HSAs are tax-deductible going in and tax-free coming out when used for qualified medical expenses.10Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans

The trade-off is access. Traditional account withdrawals before age 59½ generally add a 10% early withdrawal penalty on top of ordinary income tax, though exceptions exist for disability, a first-time home purchase (up to $10,000 from an IRA), qualified birth or adoption expenses (up to $5,000), and separation from service after age 55 for employer plans.11Internal Revenue Service. Retirement Topics – Exceptions to Tax on Early Distributions Roth IRA contributions (not earnings) can be pulled out anytime without penalty, which makes Roth accounts more flexible if you might need the money before retirement.

Donate Appreciated Assets Instead of Cash

Giving an appreciated investment directly to a qualified charity skips the capital gains tax entirely. You transfer the asset, avoid selling it, and generally deduct its full fair market value as a charitable contribution. The charity sells it tax-free.12Internal Revenue Service. Publication 526 (2025), Charitable Contributions

To claim the full fair market value deduction, the asset has to be long-term capital gain property, meaning you held it more than a year. Donate something held a year or less, or something the charity uses for a purpose unrelated to its exempt function, and the deduction drops to your cost basis.12Internal Revenue Service. Publication 526 (2025), Charitable Contributions

Deductions for fair-market-value donations of appreciated capital gain property to a public charity are capped at 30% of adjusted gross income for the year. Amounts above the cap carry forward for up to five additional tax years.13Office of the Law Revision Counsel. 26 U.S. Code 170 – Charitable, Etc., Contributions and Gifts

Spread a Sale Across Years With an Installment Contract

If a buyer pays you over several years rather than in one lump sum, the installment method lets you report the gain as each payment arrives. Every payment splits into three parts: return of cost basis (not taxed), gain (taxed at capital gains rates), and interest (taxed as ordinary income). Only the gain portion of each year’s payment counts toward that year’s capital gains.14Internal Revenue Service. Publication 537 (2024), Installment Sales

Slicing a large gain into smaller annual pieces can keep you in a lower bracket, or below the $200,000/$250,000 net investment income tax threshold, in years you otherwise would not qualify. The installment method applies automatically to qualifying sales unless you elect out. It cannot be used for sales of stocks, securities, or inventory, and does not apply to sales at a loss.14Internal Revenue Service. Publication 537 (2024), Installment Sales It is most common on sales of real estate or business assets.

Let Heirs Inherit at a Stepped-Up Basis

Property inherited at death gets a fresh cost basis equal to its fair market value on the date the original owner died. All the appreciation that built up during the owner’s life is wiped off the books; the heir owes tax only on gains after that date.15Office of the Law Revision Counsel. 26 U.S. Code 1014 – Basis of Property Acquired From a Decedent An heir who sells shortly after inheriting typically owes little or no capital gains tax.

Gifting during life is different. The recipient of a gift takes your original cost basis and will owe tax on the full appreciation dating back to your purchase when they eventually sell.16Office of the Law Revision Counsel. 26 U.S. Code 1015 – Basis of Property Acquired by Gifts and Transfers in Trust For highly appreciated assets, holding until death rather than gifting during life can save the next generation a substantial tax bill.