If you want to avoid paying capital gains tax on property, your options come down to which tool fits the property: the Section 121 exclusion for your main home, a 1031 like-kind exchange for a rental or investment property, an installment sale to spread the gain over years, a Qualified Opportunity Fund or charitable remainder trust to defer it, or holding the property until death so your heirs inherit it with a stepped-up basis. Alongside those, every seller can shrink the taxable gain itself by tracking basis improvements and subtracting selling costs, and by offsetting the gain with capital losses from other investments.
Which combination makes sense depends on the property type, how long you’ve owned it, whether you’ve claimed depreciation, and what you want to do with the proceeds.
What You’re Trying to Avoid
Capital gains tax applies to the profit from a sale: the difference between what you sold the property for and your adjusted basis, which starts with what you paid for it.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses Hold the property more than a year and the gain is long-term, taxed at preferential federal rates of 0%, 15%, or 20% depending on your income.2Office of the Law Revision Counsel. 26 USC 1222 – Other Terms Relating to Capital Gains and Losses Hold it a year or less and the gain is short-term, taxed at your regular income rates.
Two surcharges can stack on top. A 3.8% net investment income tax hits higher earners (modified AGI above $200,000 single or $250,000 married filing jointly), pushing the top federal rate on long-term gains to 23.8%.3Internal Revenue Service. Topic No. 559, Net Investment Income Tax And if you’ve claimed depreciation on a rental or investment property, the portion of your gain tied to that depreciation is taxed at up to 25% rather than the standard capital gains rate.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5 Add state income tax on top in most states, and a large sale can face a combined effective rate above 30%.
Selling Your Home: The Section 121 Exclusion
If the property is your main home, the simplest tool is the biggest. Section 121 lets a single filer exclude up to $250,000 of gain from the sale of a principal residence from tax entirely. Married couples filing jointly can exclude up to $500,000. Only gain above those amounts is taxed.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence
Two tests have to be met within the five-year window ending on the sale date. You need to have owned the home for at least two of those five years, and you need to have lived in it as your principal residence for at least two of those five years. The two years don’t have to be consecutive.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence You also can’t have used the exclusion on another home sale in the past two years.
If you fall short of the two-year marks because of a job move, a health condition, or other unforeseen circumstance recognized by IRS regulations, you can still claim a partial exclusion prorated to the time you did meet.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Note the boundary: this exclusion is for your main home. It does not apply to rental properties, second homes you don’t live in, or investment land.
Selling a Rental or Investment Property: The 1031 Exchange
For property held for business or investment, Section 1031 lets you swap one property for another of “like kind” and defer the entire capital gains tax. The gain rolls into the basis of the replacement property and isn’t recognized until you eventually sell without doing another exchange.6Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Some investors chain exchanges for decades.
“Like kind” is broad for real estate. Almost any investment or business real estate qualifies for any other: an apartment building for a strip mall, raw land for a warehouse, a farm for an office. What doesn’t qualify is your personal home, property held primarily for resale (a flip), or non-real-estate assets like stocks or partnership interests.6Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment
Rules That End the Exchange If You Break Them
You can’t touch the sale proceeds at any point. A qualified intermediary has to hold the funds from the sale of the old property and use them to buy the replacement. If the cash passes through your hands even briefly, the IRS treats the whole deal as a taxable sale.7Internal Revenue Service. Like-Kind Exchanges Under IRC Section 1031
Two deadlines run from the day you close on the sale. You have 45 calendar days to identify potential replacement properties in writing, and 180 calendar days from the same closing date to actually complete the purchase.6Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment They don’t extend for weekends, holidays, or disasters. Miss either and the deferred gain becomes immediately taxable.
You can identify up to three potential replacements regardless of value. More than three is allowed only if their combined fair market value stays within 200% of the value of the property you sold.
Partial Deferral and “Boot”
To defer the full gain, the replacement property’s value needs to equal or exceed the one you gave up, and your new mortgage needs to cover or exceed the old one. If the replacement costs less, or you walk away with cash or net debt relief, the difference is “boot” and is taxed as gain in the year of the exchange. The rest still defers.6Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment
Shrink the Gain Itself: Basis and Selling Costs
Before any deferral or exclusion strategy, the first move is to make sure the gain you’re calculating isn’t bigger than it should be.
Capital improvements add directly to your basis. Anything that materially adds value or extends the life of the property counts: a new roof, an addition, central air conditioning, a rewired electrical system, a paved driveway.8Internal Revenue Service. Publication 551 (12/2025), Basis of Assets Routine maintenance and small repairs don’t. Replacing a broken window is a repair; replacing every window in the house is an improvement.
Original closing costs also raise your basis. Title insurance, legal fees, recording fees, transfer taxes, and survey costs all count; loan origination fees and mortgage-related charges don’t.8Internal Revenue Service. Publication 551 (12/2025), Basis of Assets Keep the settlement statement and every improvement receipt. If you’re audited years later, documentation is what carries the deduction.
At the sale end, selling expenses come straight off the sale price before gain is calculated: real estate commissions, advertising, legal fees, transfer taxes you pay as the seller, and other direct costs.9Internal Revenue Service. Publication 523 (2025), Selling Your Home On a $500,000 sale, a 5% commission alone pulls $25,000 off the top.
Offset the Gain With Capital Losses
Capital losses on other investments offset capital gains dollar for dollar in the same year. Sell a stock portfolio down $80,000 in the year you sell a rental with a $200,000 gain and your net taxable gain drops to $120,000.
If total losses exceed total gains, you can deduct up to $3,000 of the net loss against ordinary income ($1,500 if married filing separately). Any excess carries forward indefinitely to future years.
One quirk helps real estate sellers. The wash sale rule, which blocks a loss deduction when you repurchase a substantially identical investment within 30 days, applies only to stock and securities.10Office of the Law Revision Counsel. 26 U.S. Code 1091 – Loss From Wash Sales of Stock or Securities You could sell a rental at a loss and buy a similar property the next day without losing the deduction.
Spread the Gain: Installment Sales
When you sell and carry the financing yourself instead of taking a lump sum, you can report the gain under the installment method. A proportional share of each principal payment is taxed as capital gain as the money comes in; the rest is a tax-free return of basis. Interest on the note is taxed separately as ordinary income. The sale goes on Form 6252.11Office of the Law Revision Counsel. 26 USC 453 – Installment Method
The payoff is bracket management. Spreading the gain across years can keep annual income in a lower capital gains bracket, soften or dodge the 3.8% net investment income surcharge, and smooth your overall tax exposure. The trade-off is cash flow and credit risk: you’re waiting on the money and betting the buyer keeps paying.
One trap for rental property: depreciation recapture can’t be deferred under the installment method. The full recapture amount is taxed in the year of sale no matter when the cash arrives.11Office of the Law Revision Counsel. 26 USC 453 – Installment Method
Qualified Opportunity Funds
Reinvest a capital gain from any source into a Qualified Opportunity Fund within 180 days of the sale and you can defer the tax on that gain.12Office of the Law Revision Counsel. 26 U.S. Code 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones The funds invest in designated low-income census tracts. Under current law, the deferred gain has to be recognized no later than December 31, 2026, with tax due on the lesser of the original deferred gain or the fund’s current fair market value.13Internal Revenue Service. Opportunity Zones Frequently Asked Questions
The lasting benefit is the 10-year rule. Hold the fund investment at least 10 years and any appreciation above your original investment can be excluded from tax entirely; the IRS adjusts your basis in the fund to fair market value when you sell.13Internal Revenue Service. Opportunity Zones Frequently Asked Questions That’s one of the few mechanisms that permanently eliminates capital gains tax on new appreciation.
Timing caveat: the election to defer gains into a Qualified Opportunity Fund can’t be made for sales occurring after December 31, 2026.12Office of the Law Revision Counsel. 26 U.S. Code 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones Because deferred gains are recognized by year-end 2026 anyway, the deferral piece has little remaining value for new 2026 investments; the real draw is the 10-year appreciation exclusion for investors willing to hold that long. Legislative changes may modify these rules.
Charitable Remainder Trusts
For highly appreciated property paired with genuine charitable intent, a charitable remainder trust can sidestep the immediate tax hit. You transfer the property into the trust, the trust sells it, and because the trust is tax-exempt, the sale inside the trust triggers no capital gains tax at that moment. The full proceeds get reinvested, you receive annual distributions for a set period or for life, and the remainder passes to the charity.
You also get a partial charitable income tax deduction in the year you fund the trust, based on the present value of the charity’s future interest. The gain isn’t permanently erased, though. Distributions carry out the trust’s realized gains to you over time, so the tax is paid in smaller slices across years rather than one lump.
These trusts are irrevocable, come with administrative costs, and carry minimum distribution rules. They fit owners of very large unrealized gains who actually want to benefit a charity and want to convert concentrated real estate into diversified income.
Hold Until Death: The Step-Up in Basis
If you hold appreciated property until you die, your heirs receive it with a basis equal to its fair market value on the date of your death. Every dollar of gain that accrued during your lifetime disappears for income tax purposes.14Internal Revenue Service. Gifts and Inheritances
A property bought for $150,000 and worth $900,000 at the owner’s death passes to the heir with a $900,000 basis. If the heir sells immediately at that price, the capital gains tax is zero. Decades of appreciation, untaxed. This is why many families with large real estate gains hold rather than sell late in life.
Gifting during your lifetime usually backfires. The recipient takes your original basis, so the tax bill transfers to them. A parent who gifts a property with a $150,000 basis to a child who later sells for $900,000 leaves the child owing tax on $750,000 of gain. Held until the parent’s death instead, that tax would be zero.
The 2026 federal estate and gift tax exemption is $15 million per person under recently enacted legislation, with no scheduled sunset, so most families can also pass property through inheritance without triggering estate tax. For estates above the exemption, the calculation gets more involved, and the choice between lifetime gifting and holding depends on weighing potential estate tax against the income tax savings from the step-up.
The Rental-Owner Trap: Depreciation Recapture
If you’ve owned a rental or investment property, there’s an extra tax layer that most of these strategies don’t fully fix. Depreciation deductions you took (or were allowed to take, whether you claimed them or not) get “recaptured” at sale: the portion of your gain equal to that depreciation is taxed at up to 25% rather than the long-term capital gains rate.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5
An example makes this concrete. Buy a rental for $300,000, claim $100,000 in depreciation over the years, and your adjusted basis drops to $200,000. Sell for $400,000 and your total gain is $200,000. Of that, $100,000 is recaptured depreciation taxed at up to 25%, and only the remaining $100,000 gets the lower long-term capital gains rate.15Internal Revenue Service. Publication 544 (2025), Sales and Other Dispositions of Assets
Which strategies cover recapture matters:
- A 1031 exchange defers recapture along with the rest of the gain.
- The step-up in basis at death eliminates it entirely.
- An installment sale does not defer it; the full recapture tax is due in the year of sale.
- The primary residence exclusion doesn’t reach rental property to begin with.
If you’re selling a property you’ve depreciated, build the recapture number into your projections before you choose a strategy. It’s the line item that most often surprises sellers at closing.