Taxes

How to Avoid Capital Gains Tax: 6 Legal Strategies

Learning how to avoid capital gains tax starts with an honest reset: “avoid” really means legally reduce or minimize — and the tax code gives you several legitimate ways to do it.

Flat fintech illustration in deep teal and gold: a rising teal investment growth chart with an upward arrow, and a large gold shield blocking a stack of teal tax bills, on a pale cream background, no text
A gold shield between your gains and the tax bill — that is what the right strategy does.

Key takeaways

  • Hold more than one year for the long-term rate: in 2026, 0% to $49,450 (single), 15% for most investors, 20% at the top.
  • Selling your main home? Exclude up to $250,000 of gain ($500,000 married filing jointly) with 24 months of ownership and use in the last 5 years.
  • Keep growth inside 401(k)s and IRAs — tax-deferred while it stays in, and qualified Roth withdrawals are tax-free.
  • Harvest losses to cancel gains dollar-for-dollar, plus up to $3,000 a year against ordinary income — mind the 30-day wash-sale rule.
  • Donate stock held over a year instead of selling: no capital gains tax, plus a deduction for the full market value.
  • At death, heirs get a step-up in basis — unrealized gains on inherited assets are effectively wiped out.

Start with the honest version: nobody legally “avoids” capital gains tax with a trick. You reduce or defer it using rules Congress wrote on purpose. One flag: this is general information, not tax advice, so run your plan past a tax professional. (See our disclaimer.)

The tax only hits when you sell an asset for more than you paid — stocks, funds, crypto, real estate, a business. Not every windfall counts: lawsuit settlements follow their own rules. For the investments and property most people sell, six legal levers do the heavy lifting.

Hold past the one-year line for long-term rates

The biggest lever is time. Sell within a year and the profit is short-term, taxed like ordinary income up to 37%. Hold more than a year and it is long-term: 0%, 15%, or 20% (Tax Foundation, from IRS Rev. Proc. 2025-32).

2026 long-term rateSingle filersMarried filing jointly
0%$0–$49,450$0–$98,900
15%$49,451–$545,500$98,901–$613,700
20%Over $545,500Over $613,700

The 0% bracket is the quiet hero: for 2026 it covers taxable income up to $49,450 single or $98,900 joint. A single filer with $40,000 of taxable income including a $10,000 long-term gain owes $0 federal tax on it. Some retirees realize gains in low-income years and immediately rebuy to reset the cost basis higher.

Selling your home? Claim the $250,000/$500,000 exclusion

Your biggest lifetime gain is probably your house — and the code’s biggest exclusion covers it. If it was your main residence, exclude up to $250,000 of gain ($500,000 married filing jointly) entirely (IRS Topic 701).

Pass two tests: own and live in the home at least 24 months of the 5 years before the sale, and no exclusion on another home in the prior 2 years. The math: buy at $280,000, sell at $680,000 — a $400,000 gain. A single filer excludes $250,000, leaving $150,000 taxable: $22,500 at 15%. And home improvements raise your adjusted basis, shrinking the gain first.

Flat fintech illustration in deep teal and gold: a teal house with a blank sold tag, a pile of gold coins, a teal tax document and a wall calendar with a gold timeline suggesting the one-year holding line, on a pale cream background, no text
Sold — the home-sale exclusion can make a house sale mostly tax-free.

Shelter growth inside retirement accounts

The simplest way to owe zero capital gains tax is to earn gains where the tax does not apply. Inside a 401(k) or traditional IRA, investments grow tax-deferred — tax only on withdrawal. In a Roth IRA or Roth 401(k), qualified withdrawals are tax-free (IRS). Keep your highest-growth assets in retirement accounts; see our investment strategies guide.

Harvest losses before year-end

Down years hand you a tax asset. Tax-loss harvesting: sell losers to realize losses that cancel winners. With $12,000 of gains and an $8,000 loss, your net gain is $4,000 — at 15% you owe $600 instead of $1,800, a $1,200 saving, if you reinvest in a similar (not identical) asset.

Two guardrails: the wash-sale rule disallows the loss if you buy the same or a “substantially identical” security within 30 days before or after (Schwab). And losses first offset gains; beyond that, deduct up to $3,000 a year against ordinary income and carry the rest forward (IRS Topic 409).

Donate appreciated assets instead of cash

If you give to charity, never sell winners to fund it. Donate shares held over a year directly: no capital gains tax on the appreciation, plus a deduction for the full fair market value (Fidelity). A donor-advised fund lets you deduct now and give later.

The end-of-life version is the step-up in basis: heirs inherit assets at market value on the date of death, so decades of unrealized gains are never taxed (Ameriprise). For assets you never plan to sell, holding for heirs can beat selling — decide with an estate planner.

Two “strategies” that do not work

First, moving to a no-income-tax state does not dodge the federal bill — capital gains tax is federal and follows you. It may trim state tax, but the state where the asset sits can still tax the sale. Our SALT deductions guide explains the two layers. Second, “hold forever” defers tax but locks up your money — deferral is a tool, not a plan.

None of these need exotic structures — they are the ordinary levers the code offers everyone. Stack them: hold long, shelter in retirement accounts, harvest losses, give smart.

Put the gains to work, not the IRS

Lower taxes compound like returns do.

Read investment strategies

Sources & further reading

All 2026 figures checked 21 Oct 2026; worked examples are our own arithmetic, shown in full above.

Frequently asked questions

Can you legally avoid capital gains tax completely?

Yes, in specific situations — but not with a loophole. If your taxable income stays inside the 2026 0% long-term bracket ($49,450 single / $98,900 married filing jointly), your long-term gains owe $0 federal tax. Gains inside a Roth IRA are permanently tax-free once qualified. A home sale within the $250,000/$500,000 exclusion is fully sheltered. Donating appreciated stock erases the gain entirely, and heirs receive a step-up in basis that wipes out unrealized gains. For everyone else, the realistic goal is minimizing — stacking the strategies above — not zero.

How long do I have to hold an asset to get the lower long-term capital gains rate?

More than one year. The IRS draws the line at one year and one day: sell after 366 days and the profit is long-term, taxed at 0%, 15%, or 20%; sell at 364 days and it is short-term, taxed as ordinary income up to 37%. That single day can nearly halve your rate. When a position is approaching the one-year mark, check the calendar before you click sell — a few weeks of patience is often the highest-paid waiting you will ever do.

How does the $250,000 home sale exclusion work?

If the house was your main home, you can exclude up to $250,000 of gain ($500,000 married filing jointly) from income. You must pass the ownership and use tests: you owned the home and lived in it at least 24 months out of the 5 years before the sale, and you did not use the exclusion on another home in the prior 2 years. Improvements raise your adjusted basis, shrinking the gain first; see our home improvements guide. Gains above the cap are taxed at normal long-term rates.

What is tax-loss harvesting, and what is the wash-sale rule?

Tax-loss harvesting means selling losing investments to realize losses that cancel out your gains dollar-for-dollar — $8,000 of losses against $12,000 of gains leaves $4,000 taxable. Leftover losses can offset up to $3,000 of ordinary income a year, with the rest carried forward. The wash-sale rule is the guardrail: if you buy the same or a “substantially identical” security within 30 days before or after the sale, the loss is disallowed. Swap into a similar-but-different fund to stay invested.

Does moving to a state with no income tax avoid capital gains tax?

No. Capital gains tax is federal, so it follows you wherever you live — a Texas or Florida address changes nothing on your federal return. Moving can trim your state tax bill, but the state where the asset sits may still tax the sale as source income. If state taxes are the concern, read our SALT deductions guide on how the state and federal layers interact — just do not expect a change of address to erase a federal gain.

Where our numbers come from