TaxInvesting

How to Avoid Capital Gains Tax: 9 Legal Strategies (2026)

By Calcinum Team ·

Capital gains tax applies when you sell an asset — stocks, real estate, crypto, or collectibles — for more than you paid. In 2026, long-term capital gains rates are 0%, 15%, or 20% depending on your income, while short-term gains are taxed as ordinary income (up to 37%).

The good news: there are several legal strategies to avoid or reduce capital gains tax that can save you thousands. These aren’t loopholes — they’re provisions built into the tax code that reward long-term investing, homeownership, and charitable giving. Here are 9 strategies to consider.

1. Hold Assets for More Than One Year

The simplest and most impactful strategy. Assets held for more than 12 months qualify for long-term capital gains rates, which are significantly lower than short-term rates:

Taxable Income (Single)Short-Term RateLong-Term RateSavings on $50K Gain
$48,476 – $103,35022%15%$3,500
$103,351 – $197,30024%15%$4,500
$197,301 – $250,52532%15%$8,500
$250,526 – $626,35035%20%$7,500

Who it’s for: Everyone. If you’re planning to sell an asset and you’re close to the one-year mark, waiting a few extra days or weeks can save you thousands in tax.

Example: You bought stock on March 1, 2024 and want to sell in February 2025 with a $30,000 gain. If you’re in the 24% bracket, selling before March 1 costs $7,200 in tax (short-term). Waiting until March 2 drops it to $4,500 (long-term) — a $2,700 savings for waiting one day.

2. Use the Primary Residence Exclusion

If you sell your primary home, you can exclude up to $250,000 in capital gains ($500,000 for married filing jointly) from federal income tax. This is one of the most generous capital gains tax loopholes in the tax code.

Requirements:

  • You owned the home for at least 2 of the last 5 years
  • You lived in it as your primary residence for at least 2 of the last 5 years
  • You haven’t used this exclusion in the past 2 years

Who it’s for: Homeowners selling their primary residence. A couple who bought a home for $300,000 and sells it for $750,000 pays zero capital gains tax on the $450,000 profit — it’s entirely excluded.

Limits: The 2-out-of-5-year test means you can use this exclusion roughly every 2 years. It does not apply to rental properties or second homes (though partial exclusions may apply in some cases — see FAQ below).

3. Tax-Loss Harvesting

Tax-loss harvesting means selling investments at a loss to offset capital gains from other investments. If your losses exceed your gains, you can deduct up to $3,000 per year against ordinary income ($1,500 if married filing separately), with excess losses carried forward to future years.

How it works:

  1. You sell Stock A for a $20,000 gain
  2. You also sell Stock B, which is down $15,000
  3. Your net capital gain is only $5,000 ($20,000 - $15,000)
  4. You can reinvest in a similar (but not “substantially identical”) asset to maintain your portfolio allocation

Who it’s for: Investors with both winners and losers in their portfolio. Many robo-advisors (Wealthfront, Betterment) automate tax-loss harvesting throughout the year.

Watch out: The wash-sale rule prevents you from claiming a loss if you buy the same or a “substantially identical” security within 30 days before or after the sale. You can buy a similar ETF (e.g., sell an S&P 500 fund and buy a total market fund) without triggering the wash-sale rule.

4. Invest in Opportunity Zones

Qualified Opportunity Zones (QOZs) are designated low-income communities where investments receive special capital gains tax treatment. By investing capital gains into a Qualified Opportunity Fund within 180 days of realizing the gain, you can:

  • Defer the original capital gains tax until 2026 (or when you sell the QOZ investment)
  • Exclude up to 100% of any new gains from the QOZ investment if held for at least 10 years

Who it’s for: Investors with significant capital gains who are willing to invest in designated zones for 10+ years. QOZ investments are typically in real estate development or business ventures in underserved areas. The minimum commitment is long, and liquidity is limited.

5. Use a 1031 Exchange (Real Estate)

A 1031 exchange (also called a like-kind exchange) allows you to defer capital gains tax when you sell investment real estate by reinvesting the proceeds into another “like-kind” property. There’s no limit on how many times you can do this — some investors defer gains for decades by continually exchanging properties.

Requirements:

  • Both properties must be held for investment or business use (not your personal residence)
  • You must identify replacement property within 45 days of selling
  • You must close on the replacement property within 180 days
  • The replacement property must be of equal or greater value to defer 100% of the gain
  • You must use a qualified intermediary to hold the funds (you can’t touch the money)

Who it’s for: Real estate investors looking to upgrade properties, diversify, or relocate investments without triggering a tax event. A landlord selling a $500K rental with $200K in gains can roll into a $600K property and pay zero capital gains tax at the time of exchange.

6. Donate Appreciated Assets to Charity

Instead of selling an appreciated asset and donating the cash, donate the asset directly to a qualified 501(c)(3) charity. You get a double tax benefit:

  1. No capital gains tax on the appreciation — you avoid the tax entirely
  2. Charitable deduction for the full fair market value of the asset (if held over 1 year)

Example: You have stock worth $50,000 that you bought for $10,000. If you sell and donate cash: you pay ~$6,000 in capital gains tax, then donate $44,000. If you donate the stock directly: you pay $0 in capital gains tax and deduct the full $50,000 — saving $6,000+ in tax while the charity receives the same amount.

Who it’s for: Charitably inclined investors with highly appreciated assets. Donor-advised funds (DAFs) like Fidelity Charitable or Schwab Charitable make it easy to donate stock and distribute grants to charities over time.

Limits: Deductions for appreciated property donated to public charities are limited to 30% of AGI. Excess can be carried forward for up to 5 years.

7. Offset Gains with Capital Losses

Even without active tax-loss harvesting, you can use capital losses to reduce your tax bill:

  • Capital losses first offset capital gains dollar-for-dollar (short-term losses offset short-term gains first, then long-term)
  • If your total losses exceed total gains, you can deduct up to $3,000 per year ($1,500 MFS) against ordinary income
  • Unused losses carry forward indefinitely to future tax years

Who it’s for: Any investor who has realized losses. Don’t let losses go to waste — even if you don’t have gains this year, harvesting losses creates a carryforward that can offset future gains or reduce ordinary income by $3,000/year.

8. Gift Assets to Family in Lower Brackets

You can gift appreciated assets to family members who are in a lower tax bracket — potentially the 0% long-term capital gains bracket. In 2026, single filers with taxable income up to $48,475 pay 0% on long-term capital gains.

How it works: You gift stock worth $20,000 (cost basis $5,000) to your adult child who earns $30,000. They sell it, realizing a $15,000 long-term gain. Since their total taxable income ($45,000) is below the $48,475 threshold, they pay $0 in federal capital gains tax.

Limits:

  • Annual gift tax exclusion: $19,000 per recipient in 2026 (no gift tax for the giver)
  • The kiddie tax applies to children under 19 (or under 24 if full-time students): unearned income above $2,500 is taxed at the parent’s rate, making this strategy ineffective for minor children
  • The recipient inherits your cost basis (not a stepped-up basis)

9. Step-Up in Basis at Death

When you inherit an asset, your cost basis is “stepped up” to the asset’s fair market value on the date of death — regardless of what the original owner paid. All unrealized capital gains accumulated during the original owner’s lifetime are permanently eliminated.

Example: Your parent bought stock for $10,000 in 1990. It’s worth $200,000 when they pass away. Your cost basis is $200,000, not $10,000. If you sell immediately, your capital gain is $0 — the $190,000 in appreciation is never taxed.

Who it’s for: Estate planning. This is one reason financial advisors often recommend holding highly appreciated assets rather than selling them in retirement. The step-up in basis effectively makes the accumulated gains tax-free for heirs.

Note: This applies to assets transferred at death, not gifts during the owner’s lifetime. Gifted assets retain the original owner’s cost basis (carryover basis).

How to Calculate Your Capital Gains

Use our capital gains tax calculator to estimate the tax on any asset sale — including short-term vs. long-term rates, the NIIT surtax (3.8% on high earners), and the home sale exclusion. For your overall federal tax picture, use our tax calculator to see how capital gains interact with your other income and deductions.

Want to understand which bracket your gains fall into? Our tax bracket calculator shows exactly how the 0%, 15%, and 20% capital gains thresholds apply to your specific income level.

Frequently Asked Questions

Can I avoid capital gains tax entirely?

Yes, in several scenarios: selling your primary home within the $250K/$500K exclusion, realizing gains within the 0% long-term bracket (taxable income under $48,475 single / $96,950 married in 2026), donating appreciated assets to charity, or holding assets until death (step-up in basis). For most investors, the goal is to minimize rather than completely eliminate capital gains tax through a combination of strategies.

What is the 0% capital gains rate?

In 2026, long-term capital gains are taxed at 0% if your total taxable income (including the gains) stays below $48,475 (single) or $96,950 (married filing jointly). This means a married couple with $80,000 in taxable income could realize up to $16,950 in long-term gains and pay zero federal tax on them. This is one of the most underused capital gains tax loopholes available.

Does the primary residence exclusion apply to rental property?

Not directly. The Section 121 exclusion requires the property to be your primary residence for at least 2 of the 5 years before the sale. However, if you converted a rental property to your primary residence and lived in it for 2+ years, you may qualify for a partial exclusion. Gains attributable to periods of “non-qualified use” (rental use after 2008) are not excludable. A 1031 exchange is typically the better option for investment properties.

What is tax-loss harvesting?

Tax-loss harvesting is the practice of selling investments that have declined in value to realize capital losses, which then offset capital gains from profitable sales. If your losses exceed your gains, you can deduct up to $3,000/year against ordinary income. The key rule to follow is the wash-sale rule: you cannot buy the same or substantially identical security within 30 days before or after the sale, or the loss is disallowed. You can buy a similar but not identical investment to maintain your portfolio allocation.

How does the step-up in basis work?

When someone dies and leaves assets to heirs, the cost basis of those assets is “stepped up” to the fair market value on the date of death. This means all unrealized capital gains accumulated during the decedent’s lifetime are permanently eliminated — the heirs can sell the asset immediately at the stepped-up value and owe zero capital gains tax. This applies to stocks, real estate, and most other capital assets. It’s one of the most powerful estate planning tools in the tax code, and a key reason advisors recommend holding (rather than selling) highly appreciated assets in retirement.

C

Calcinum Team

Free, accurate calculators for salary, tax, and finance.