How to Offset Capital Gains on Real Estate: Exclusions, 1031, and Losses

Offsetting capital gains on real estate comes down to a handful of levers: raise your cost basis with improvements and selling costs, claim the primary residence exclusion if the property is your home, or, for investment property, defer the tax through a 1031 exchange, an installment sale, a Qualified Opportunity Fund, or capital losses from other investments. Which levers you can pull depends on whether the property was your home or an investment, how long you owned it, and what you plan to do with the proceeds.

Held for a year or less, the profit is taxed at ordinary income rates. Held longer, it qualifies for long-term capital gains rates of 0%, 15%, or 20% depending on your taxable income.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses High earners can also owe an additional 3.8% Net Investment Income Tax on top of that.2Internal Revenue Service. Topic No. 559, Net Investment Income Tax Everything below is aimed at shrinking the number those rates apply to, or pushing the tax into a later year.

Start With the Gain Itself

Your taxable gain is the sale price minus your adjusted basis, so every strategy is really a way of moving one of those two numbers. The cost basis starts with what you paid for the property, including settlement costs like title insurance, recording fees, and transfer taxes.3Office of the Law Revision Counsel. 26 USC 1012 – Basis of Property Cost From there, capital improvements you made during ownership raise the basis and shrink the gain.4Office of the Law Revision Counsel. 26 USC 1016 – Adjustments to Basis

One important boundary before going further. If the property was a rental or other investment property and you claimed depreciation, your basis has to be reduced by the depreciation you took (or could have taken).5Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5 The portion of the gain equal to that depreciation is taxed at up to 25%, not the standard long-term rate.1Internal Revenue Service. Topic No. 409, Capital Gains and Losses This depreciation recapture is not offset by the primary residence exclusion, and it survives even a 1031 exchange only to the extent you fully replace the property. Plan around it accordingly.

Raise Your Adjusted Basis

The cheapest offset is the paperwork you already have. To count as a capital improvement, the work must add value to the property, extend its useful life, or adapt it to a new use — a new roof, a room addition, a finished basement.6eCFR. 26 CFR 1.1016-2 – Items Properly Chargeable to Capital Account Routine repairs that just keep the property in its current condition, like patching a leak or repainting, do not qualify.

Selling expenses come off the sale side of the equation and produce the same result. Real estate commissions, advertising, legal fees, and loan charges you paid for the buyer all reduce the taxable gain.7Internal Revenue Service. Publication 523, Selling Your Home Keep the receipts, invoices, and closing statements. Without them, the IRS can disallow the adjustments if your return is questioned.

Claim the Primary Residence Exclusion

If the property is your main home, this is usually the biggest lever. A single filer can exclude up to $250,000 of gain from tax, and a married couple filing jointly can exclude up to $500,000.8Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence For most homeowners, that wipes the tax out entirely.

To qualify, you must have owned the home and used it as your principal residence for at least two years total during the five years ending on the sale date. The two years don’t have to be consecutive. For the $500,000 joint exclusion, either spouse must meet the ownership test, both must meet the use test, and neither can have claimed the exclusion in the prior two years.8Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Selling early because of a job change, a health issue, or another unforeseeable event still gets you a partial exclusion. The IRS prorates it: divide the time you actually lived in the home by 24 months (or 730 days), then multiply by $250,000.7Internal Revenue Service. Publication 523, Selling Your Home Eighteen months of qualifying use gives a single filer a $187,500 exclusion; married joint filers run the calculation for each spouse and add the results.

Two limits are worth knowing. You can only claim the exclusion once every two years. And if you rented the home out and took depreciation after May 6, 1997, the portion of gain equal to that depreciation stays taxable at up to 25%, even though the rest may be excluded.5Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5

Defer With a 1031 Like-Kind Exchange

For investment or business real estate, a 1031 exchange lets you roll the entire gain into a replacement property and defer the tax indefinitely. Both properties must be real property held for investment or business use.9Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Since 2018, only real property qualifies; personal property, vehicles, and equipment do not.10Internal Revenue Service. Like-Kind Exchanges – Real Estate Tax Tips Your personal residence and fix-and-flip inventory are out.

Within real property, “like-kind” is broad. A rental house can be exchanged for an apartment building, a warehouse, or vacant land. Most exchanges are deferred, meaning you sell first and then buy a replacement. The critical rule is that you cannot take control of the sale proceeds at any point. A qualified intermediary has to hold the funds between transactions, and touching the cash yourself, even briefly, can blow up the whole exchange.11Internal Revenue Service. Like-Kind Exchanges Under IRC Section 1031

The deadlines are strict. You have 45 days from the sale to identify potential replacement properties in writing, and 180 days total to close on the replacement (or your tax return due date with extensions, whichever comes first).9Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Miss either one and the full gain becomes taxable that year. Any cash or non-real-property value you walk away with, called boot, is taxed even if the rest of the deal qualifies.

Offset With Capital Losses

Losses on other investments can absorb some of your real estate gain. Short-term losses first offset short-term gains, and long-term losses first offset long-term gains; leftover losses then cross over to the other category.12Office of the Law Revision Counsel. 26 USC 1211 – Limitation on Capital Losses If your losses still exceed your gains for the year, you can deduct up to $3,000 of the remainder against ordinary income ($1,500 if married filing separately), and anything left carries forward to future years indefinitely.13Office of the Law Revision Counsel. 26 USC 1212 – Capital Loss Carrybacks and Carryovers

Some investors deliberately harvest losses on underperforming holdings in the same tax year as a real estate sale to soak up the gain. One boundary: a loss on the sale of your personal home is not deductible. Only losses from investment or business property count.

Spread the Tax With an Installment Sale

Instead of collecting all the money at closing, you can finance the buyer yourself and take payments over several years. The gain is taxed as you receive it, so a large sale that would push you into higher brackets in one year can be smoothed across several.14Office of the Law Revision Counsel. 26 USC 453 – Installment Method

Each payment you receive breaks into three parts: a tax-free return of basis, the capital gain portion at your applicable long-term or short-term rate, and interest income taxed at ordinary rates. You report each year’s numbers on IRS Form 6252.15Internal Revenue Service. Publication 537, Installment Sales The installment method also carries an interest requirement: if any payments come more than a year after the sale, the contract must charge minimum interest, or the IRS will impute it and reclassify part of the sale price as ordinary interest income.16Office of the Law Revision Counsel. 26 USC 483 – Interest on Certain Deferred Payments

Reinvest Through a Qualified Opportunity Fund

You can also defer the gain by rolling it into a Qualified Opportunity Fund, which invests in designated low-income communities. The reinvestment has to happen within 180 days of the sale.17Office of the Law Revision Counsel. 26 USC 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones Hold the QOF investment for at least 10 years and any appreciation on the fund investment itself becomes permanently tax-free when you sell it.18Internal Revenue Service. Invest in a Qualified Opportunity Fund The original deferred gain does not disappear, though; it comes due later.

The mechanics are shifting. For investments made on or before December 31, 2026, the deferred gain becomes taxable on that date (or earlier if you sell the QOF investment first). For new investments after December 31, 2026, the rule changes to a rolling five-year deferral rather than a fixed date.17Office of the Law Revision Counsel. 26 USC 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones Timing matters if you’re weighing this option.

Hold and Pass It On

The strategy that eliminates the most gain is not selling at all. When someone inherits real estate, the property’s basis resets to its fair market value on the date of the previous owner’s death.19Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent Decades of appreciation during the owner’s lifetime are effectively erased for capital gains purposes.

A parent who bought a home for $150,000 that is worth $450,000 at death leaves the heir with a $450,000 basis. Selling right away at that price produces zero taxable gain. The rule applies to property received through a will, an estate, or a revocable trust, which is why some families choose to hold appreciated real estate for heirs rather than sell it during their lifetimes.