You can legally avoid, defer, or reduce capital gains tax on investment property through several established strategies: a 1031 exchange into another investment property, conversion of the property into your primary residence, reinvestment into a Qualified Opportunity Fund, an installment sale that spreads the gain across years, offsetting the gain with capital losses, increasing your cost basis with improvements and selling costs, or holding the property until death so heirs receive a stepped-up basis. Which one fits depends on what you want to do next with the money, how long you can wait, and how much of the profit came from depreciation you’ve already deducted. Federal long-term capital gains rates run 0%, 15%, or 20% depending on income, and higher earners owe an additional 3.8% net investment income tax on top of that.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses
Trade Into Another Property With a 1031 Exchange
A 1031 exchange defers the entire capital gain when you reinvest the sale proceeds into another investment property of like kind. The like-kind standard is broad for real estate: any real property held for business or investment use qualifies, so an apartment building can be swapped for a warehouse, or a vacant lot for a strip mall.2Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment You can keep exchanging across a lifetime, pushing the tax bill forward indefinitely.
The mechanics are strict. You cannot take possession of the sale proceeds at any point. A qualified intermediary holds the funds between the two closings, and if you touch the money even briefly, the IRS treats the deal as a taxable sale.3Internal Revenue Service. Revenue Procedure 2003-39 Any cash or non-like-kind property you pocket in the trade (called “boot”) is taxable up to the amount of your gain.
Two deadlines run from the day you close on the property you’re giving up. You have 45 days to identify replacement properties in writing, and 180 days total to close on the new property. Miss either and the full gain becomes taxable that year.2Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment You may name up to three properties regardless of their combined value, or any number as long as their total fair market value stays within 200% of what you sold.
Reverse Exchanges
If you find your replacement property before selling the old one, a reverse exchange lets you buy first and sell second. Because you cannot legally own both under the exchange rules, an exchange accommodation titleholder parks title to the new property until the old one closes. Under an IRS safe harbor, everything must wrap up within 180 days.4Internal Revenue Service. Revenue Procedure 2000-37 Reverse exchanges cost more because of the additional intermediary, but they solve timing problems that would otherwise kill a deal.
Move In and Use the Primary-Residence Exclusion
If you convert the investment property into your main home and live there long enough, you can exclude a substantial slice of the gain when you eventually sell. The exclusion is $250,000 for a single filer and $500,000 for a married couple filing jointly, provided you owned and used the property as your principal residence for at least two of the five years before the sale.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain from Sale of Principal Residence Utility bills, voter registration, and the address on your tax returns all help establish the residency.
The Non-Qualified Use Limitation
The full exclusion doesn’t apply to years the property spent as a rental. The IRS allocates part of your gain to “non-qualified use” periods, which generally means any time it wasn’t your primary residence. Certain exceptions apply, including periods after you move out within the five-year window and some temporary absences for health or employment. The allocated gain equals the total gain multiplied by the ratio of non-qualified-use months to total ownership months, and that portion is not excludable.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain from Sale of Principal Residence
Say you owned a property for ten years, rented it for six, then lived in it for four before selling. Sixty percent of the gain gets allocated to non-qualified use and is fully taxable. Only the remaining 40% can be excluded, up to the $250,000 or $500,000 ceiling. Non-qualified use before January 1, 2009, is not counted against you.
Depreciation Recapture Is Not Excluded
Even when the exclusion shields most of the gain, you still owe tax on the depreciation deductions you took (or were entitled to take) while the property was a rental. This “unrecaptured Section 1250 gain” is taxed at a maximum rate of 25%; if your ordinary rate is lower, you pay the lower rate on that portion.6Office of the Law Revision Counsel. 26 USC 1 – Tax Imposed The recapture covers depreciation adjustments taken after May 6, 1997, and the primary-residence exclusion does not touch it.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain from Sale of Principal Residence
Reinvest Into a Qualified Opportunity Fund
Qualified Opportunity Zones, created by the Tax Cuts and Jobs Act of 2017, offer another deferral path. Within 180 days of realizing a capital gain from any source, you can reinvest the profit into a Qualified Opportunity Fund and defer the tax on that gain. The fund must hold at least 90% of its assets in designated Opportunity Zone property.7Internal Revenue Service. Opportunity Zones
The 2026 Recognition Date
All deferred gains from QOF investments become recognizable on December 31, 2026, whether or not you’ve sold the fund interest. If you still hold the investment on that date, you owe tax on the original deferred gain as if you had sold.8Internal Revenue Service. Opportunity Zones Frequently Asked Questions Earlier basis step-ups of 10% after five years and 15% after seven years have expired and are no longer available.9U.S. Department of Housing and Urban Development. Opportunity Zones Investors
The Ten-Year Appreciation Exclusion
The real prize now is the ten-year rule. Hold your QOF investment for at least ten years, and the basis of the fund interest adjusts to its fair market value on the date of sale. Any appreciation inside the fund itself escapes tax entirely.7Internal Revenue Service. Opportunity Zones You’ll still owe tax on the original deferred gain in 2026, but the growth after that is tax-free if you wait long enough.
Spread the Gain With an Installment Sale
An installment sale stretches the tax bill across years instead of concentrating it in one. Rather than collecting the full price at closing, you accept a promissory note and receive principal and interest over time. You report gain only on the principal actually received each year, which can keep the sale from pushing you into a higher bracket.10Office of the Law Revision Counsel. 26 USC 453 – Installment Method Interest is taxed separately as ordinary income.
Depreciation Recapture Hits Year One
The catch: depreciation recapture must be recognized entirely in the year of sale, even if you’ll collect most of the price later. The installment method defers only the capital gain portion of the profit. If you’ve taken years of depreciation on a rental, this can still produce a large tax bill at closing.
Dealers Cannot Use It
The installment method is unavailable to real estate “dealers”: investors who hold property primarily for sale to customers in the ordinary course of business. If the IRS classifies you as a dealer rather than a long-term investor, which is common for frequent flippers, you owe the full gain in the year of sale regardless of when you’re paid. The classification turns on factors like how often you buy and sell, how long you hold, and whether real estate is a primary income source.
Offset the Gain With Capital Losses
Losses from other investments (stocks, bonds, or another property sold at a loss) offset the gain from your property sale dollar for dollar. A $50,000 stock loss wipes out $50,000 of property gain. The netting happens on Schedule D: short-term losses first offset short-term gains, long-term losses first offset long-term gains, and any leftover crosses over.11Internal Revenue Service. 2025 Schedule D (Form 1040) – Capital Gains and Losses
If total losses exceed total gains, you can deduct up to $3,000 of the excess against ordinary income ($1,500 if married filing separately). Anything left rolls forward to future years indefinitely.12Internal Revenue Service. Instructions for Schedule D – Capital Losses Timing a strategic loss harvest in the same year as a profitable property sale can meaningfully reduce the check to the IRS.
Raise Your Cost Basis
Your taxable gain is the sale price minus your adjusted cost basis. A higher basis means a smaller gain. Two categories of expenses raise it: capital improvements during ownership and selling expenses at closing.
Capital Improvements
Capital improvements add value, extend useful life, or adapt the property to a new use. New HVAC systems, roof replacements, room additions, decks, and upgraded plumbing or electrical all qualify.13Internal Revenue Service. Publication 523 (2024), Selling Your Home – Improvements Routine repairs like patching drywall or fixing a leaky faucet do not. Keep receipts, contractor agreements, and permits. Without documentation, the addition to basis won’t survive scrutiny.
Selling Expenses
Costs tied directly to the sale come off the selling price when the gain is calculated. Real estate commissions, legal fees, and title insurance premiums all count.14Internal Revenue Service. Publication 523 (2024), Selling Your Home – Selling Expenses On a high-value property, agent commissions alone can shave tens of thousands off the taxable gain. Pull them straight from the closing statement.
Hold Until Death for a Stepped-Up Basis
When investment property passes to heirs at the owner’s death, the basis resets to fair market value on the date of death. Every dollar of gain that built up during the owner’s lifetime disappears for tax purposes.15Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired from a Decedent A parent who bought a rental for $100,000 that’s worth $600,000 at death leaves the heir with a $600,000 basis. Sold immediately for $600,000, the heir owes nothing.
This is why many investors chain 1031 exchanges through their lifetime and then let the step-up eliminate the accumulated deferrals at death. For jointly owned property, the surviving spouse generally receives a step-up on the deceased spouse’s share. Heirs owe capital gains tax only on appreciation after the date of death.
Account for the 3.8% Net Investment Income Tax
Higher-income investors owe an additional 3.8% surtax on net investment income, including property-sale gains. The tax applies to the lesser of your net investment income or the amount by which your modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).16Internal Revenue Service. Topic No. 559, Net Investment Income Tax These thresholds are not indexed for inflation, so more taxpayers cross them each year.17Internal Revenue Service. Questions and Answers on the Net Investment Income Tax
Combined with a 20% long-term capital gains rate, the total federal hit can reach 23.8% before state taxes. Deferral and exclusion strategies that reduce the gain in a given year can also keep your income below the surtax threshold, which is why the NIIT belongs in the planning conversation for any sizable sale.