How to Avoid Capital Gains Tax on Real Estate: Eight Legal Methods and What Each Saves
The eight methods compared
Every method either removes the gain, defers it to a later year, or spreads it. None are available for every property, and several carry costs or risks. Use the table to see which fits your sale before reading the details.
| Method | Effect | Best fit | Main limit |
|---|---|---|---|
| Home-sale exclusion (IRC 121) | Excludes up to $250,000 / $500,000 (2026) | Your main home | 2-of-5-year test; not for rentals |
| 1031 exchange (IRC 1031) | Defers all gain | Investment and business real estate | 45-day / 180-day deadlines; buy equal or greater value |
| Installment sale (IRC 453) | Spreads gain over note term | Seller can carry financing | Buyer credit risk; recapture taxed in year one |
| Step-up at death (IRC 1014) | Erases gain for heirs | Owners who can hold for life | Concentrated, illiquid, not a sale strategy |
| Opportunity zone fund | Defers gain invested within 180 days | Long-horizon investors | Investment risk; rules changed in 2025 |
| Charitable remainder trust (IRC 664) | Defers and spreads over a payout stream | Charitable intent | Gift is irrevocable |
| Donation of the property | Avoids gain; income-tax deduction | Philanthropic owners | You give up the asset |
| Offset with losses (IRC 1211) | Cancels gain dollar for dollar | Anyone with realized losses | Only realized, same-year or carried losses |
Exclude the gain on your home
The only complete exclusion for a living owner is the main-home rule. Own it and live in it for 2 of the 5 years before sale and you exclude up to $250,000 of gain, or $500,000 filing jointly. Depreciation you claimed after May 6, 1997 is not excluded.
A rental that becomes your residence for the last two years can qualify in part. The full rules are on selling a house.
Defer with a 1031 exchange
For investment or business real estate, a like-kind exchange under IRC 1031 defers all the gain if you identify replacement property within 45 days and close within 180 days, using a qualified intermediary, and buy property of equal or greater value with all the proceeds.
Since 2018, only real property qualifies. The gain is not forgiven; your basis carries into the new property, and the deferred gain and depreciation recapture come due when you eventually sell for cash.
If you cannot find a replacement, an installment sale instead of a 1031 is the common alternative, and a failed exchange has its own consequences (failed 1031 exchange). Start with the 1031 exchange analysis.
Spread the gain with an installment sale
If you receive at least one payment after the year of sale, you can report the gain as payments come in (IRC 453). Each payment carries a gross-profit share of gain. In our Arizona example the rental produces a $750,000 gain.
Sold for cash in one year, the federal and state tax is $180,283. Sold on a five-year note with equal principal payments, tax is $152,378 in total, a difference of $27,905, because the long-term gain is spread across lower brackets and below the 3.8% NIIT threshold in some years.
Depreciation recapture is reported in year one regardless of when you are paid, so the $150,000 of unrecaptured 1250 gain is in the first year. Note interest is taxable. Run your own case in the installment sale analysis.
Hold until death for a stepped-up basis
Property included in a decedent's estate takes a basis equal to its fair market value at death (IRC 1014). An heir who inherits a building bought for $200,000 and worth $950,000 and sells it at $1,000,000 has a $40,000 gain, not an $800,000 one, and pays $7,980 of tax in Illinois on the example.
Heirs also receive long-term treatment automatically. This is the largest single tax-avoidance feature in the code for real estate, and the reason many owners never sell. The cost is that the property stays illiquid and concentrated. See step-up at death and inherited property.
Opportunity zones, charitable trusts and donation
A Qualified Opportunity Fund investment of capital gain within 180 days of the sale defers recognition of the invested gain, and the program was changed by 2025 legislation (see opportunity zones).
A charitable remainder trust sells the property inside the trust without immediate tax and pays you income for a term or life, spreading the gain over the payout (IRC 664). Donating the property outright to a qualified charity avoids the gain and produces a deduction.
Each commits the property or the proceeds to a structure you cannot reverse.
What none of these remove: depreciation and the 3.8% surtax
Depreciation taken on rental real estate is taxed on a sale at up to 25% in 2026 (unrecaptured section 1250 gain) unless you defer through a 1031 or hold until death. Investors with modified AGI above $250,000 joint or $200,000 single also owe the 3.8% net investment income tax on the gain (IRC 1411).
Check both on your own sale in the capital gains tax calculator, and see depreciation recapture for how the 25% layer is computed.
What to know
Deferral is not avoidance: the tax comes due later, sometimes at higher rates, and a failed deadline can make a 1031 exchange fully taxable. Installment notes put the buyer's credit risk on you. Aggressive structures such as monetized installment sales are listed by the IRS as abusive.
Results here use 2026 federal tables (Rev. Proc. 2025-32) and modeled state rules, and assume the incomes in each example. This is general information, not tax advice; use a CPA or attorney for a sale.
How much tax does this sale cause? A worked example
Joint filers, $150,000 of other income. A rental sold for a $750,000 gain: $150,000 is depreciation (unrecaptured 1250 gain) and $600,000 is long-term gain, all in one year. Same gain spread over five years with equal principal payments.
The 1250 gain is taken first in year one, then $150,000 of long-term gain a year for four years. Other income of $150,000 each year. Heir inherits a building the parent bought for $200,000, value at death $950,000, and sells for $1,000,000 less costs: $40,000 gain after step-up. Single heir, $140,000 other income, Illinois.
| Engine run | Cash sale of an Arizona rental, one year | Same rental sold on a five-year installment note | Inherited apartment sold at stepped-up basis |
|---|---|---|---|
| Filing status | Married, joint | Married, joint | Single |
| State | Arizona | Arizona | Illinois |
| Tax years | 1 | 5 | 1 |
| Other income (wages, pension, interest) per year | $150,000 | $150,000 | $140,000 |
| Long-term capital gain | $600,000 | $600,000 | $40,000 |
| Unrecaptured Section 1250 gain (25% max) | $150,000 | $150,000 | $0 |
| Federal income tax on the sale | $136,833 | $124,128 | $6,000 |
| Net investment income tax (3.8%) | $24,700 | $9,500 | $0 |
| State income tax on the sale | $18,750 | $18,750 | $1,980 |
| Total tax caused by the sale | $180,283 | $152,378 | $7,980 |
| Effective rate on the gain | 24.0% | 20.3% | 20.0% |
| Gain kept after these taxes | $569,717 | $597,622 | $32,020 |
Computed November 6, 2026 by the Big Sale Tax engine (engine.js yearTax): federal brackets, 0/15/20% thresholds and AMT from Rev. Proc. 2025-32 (OBBBA-adjusted) and the One Big Beautiful Bill Act (P.L. 119-21); NIIT under IRC 1411 (thresholds not indexed); state tax from the engine's state table. "Tax caused by the sale" = tax with the sale minus tax without it. Excludes selling costs, local taxes and estimated-tax timing. Education only.
How much tax would you owe? Run your own numbers
2026 law from the engine: federal 0/15/20% brackets (Rev. Proc. 2025-32), 25% cap on unrecaptured 1250 gain, ordinary rates on 1245 recapture, 3.8% NIIT over $200,000 single / $250,000 joint (IRC 1411), AMT, and your state's rules (California on the FTB 2026 schedules).
What was sold and years held only matter in a few states: Washington exempts real estate, Ohio and New Mexico treat a business sale differently, Arizona subtracts 25% for assets bought after 2011 and Oklahoma deducts gain on Oklahoma property held 5 years or more.
Tax shown is the tax caused by the sale. Excludes local taxes other than Maryland's county tax (3.2% used). Tick the active-owner box if you materially participate in the business. Education only.
Long-Term vs Short-Term Capital Gains (2026)
The one-year holding rule, the 2026 0/15/20% thresholds for every filing status, NIIT, recapture, the state layer and a worked $200,000 example: 11 months vs 13 months, and what spreading the gain can save.
Frequently asked questions
How can I avoid paying capital gains tax on real estate?
Can I avoid capital gains if I reinvest the money in another house?
How long do I have to own a rental property to avoid capital gains?
Does paying down a mortgage or buying a second property avoid tax?
Does moving to a state with no income tax avoid capital gains tax?
What is the IRS 45-day and 180-day rule?
Sources
- IRC 1031: exchange of real property held for investment (Cornell LII)
- IRC 453: installment method (Cornell LII)
- IRC 121: exclusion on sale of principal residence (Cornell LII)
- IRC 1014: basis of property acquired from a decedent (Cornell LII)
- IRC 1: tax imposed, including 1(h) capital gain rates (Cornell LII)
- Treas. Reg. 1.453-12 (eCFR)
- IRS: Like-kind exchanges, real estate tax tips
Figures as of October 7, 2026; each rate and limit above names its source and year. Education only, not legal or tax advice.
Keep reading
Capital gains tax calculator
The order of operations behind any capital gains calculator, with four worked sales: a rental, a business, a home over the exclusion and a common input mistake.
ReadSelling a house
Who qualifies for the $250,000 / $500,000 exclusion, what breaks it, and exactly what tax applies to the gain above it.
ReadRental property
How a rental sale is really taxed: the 25% depreciation layer, the losses the sale finally frees, the 3.8% tax, and why moving in first rarely helps.
Read1031 exchange
Defer the whole gain by trading investment real estate for more real estate, if you can find it and close inside 180 days.
ReadInstallment sale (Section 453)
Report the gain as the buyer pays you instead of all in the year of sale, under rules that have been in the tax code for decades.
ReadStep-up at death (hold)
Holding an appreciated asset until death can erase the built-in gain for heirs; here is when that beats selling now and when it does not.
ReadKnow your number before you sign.
Start with a free scope call: a short call to see whether the Big Sale Tax Analysis is worth it for your sale. No obligation.
Prefer email? Request the analysis by email.
You talk to Hans Goldstein. Enrolled Agent, admitted to practice before the IRS.