Avoiding Capital Gains on Real Estate

How homeowners legally reduce taxable gain on a home sale using adjusted basis, capital improvements, selling costs, and the Section 121 exclusion.

Most people who sell the home they live in do not owe federal tax on the sale, and the reason is not a rollover into another property. It is ordinary math: adjusted basis, selling costs, and the Section 121 exclusion, applied in the right order, absorb most of the gain before a tax rate ever enters the picture.

Adjusted basis starts with what was paid for the home, then adds documented capital improvements and subtracts any depreciation claimed if part of the home was ever rented. Selling costs come off the amount realized. What is left after those two steps is the gain, and for an owner who lived in the home two of the last five years, up to $250,000 of that gain is excluded from federal tax, or $500,000 for a married couple filing jointly.

The math does not work the same way for every seller. A home held for decades in an appreciating market, a second home, or a property with a rental history can produce gain above the exclusion. Those cases call for a closer look at basis records, depreciation recapture, and whether any part of the property was genuinely converted to investment use.

Gain is not the sale price. It is the sale price, less selling costs, minus adjusted basis. Adjusted basis begins with the original purchase price plus settlement costs paid at closing, then adds the cost of capital improvements made during ownership: a new roof, a room addition, replacement windows, a finished basement, a new HVAC system.

Repairs and routine maintenance do not count. Painting a room, fixing a leaking faucet, or replacing a broken window pane keeps the house in its existing condition and does not add to basis. The distinction matters because misclassifying a maintenance expense as an improvement inflates basis and understates gain, which is the kind of error an IRS review catches quickly if the return is examined.

Keeping receipts, contractor invoices, and permits for every improvement made over the years of ownership is the single most useful thing a homeowner can do before selling. Without records, a seller is left estimating, and estimates favor the government, not the taxpayer.

The amount realized on a sale is not the contract price. It is the contract price minus real estate commissions, title insurance premiums paid by the seller, transfer taxes, attorney fees, and other costs directly tied to closing the transaction. Staging costs and some pre-sale repairs negotiated as part of the deal can sometimes be added here as well, depending on how they were structured in the contract.

On a $700,000 sale with a 5 percent commission and $8,000 in other closing costs, roughly $43,000 comes off the top before gain is calculated. That is not a deduction taken on a tax return line; it reduces the amount realized directly, which lowers the gain that Section 121 and any remaining tax rate apply to.

Section 121 lets a homeowner exclude up to $250,000 of gain from federal tax, or $500,000 on a joint return, if the ownership and use tests are met: the home was owned and used as the seller's main residence for at least two of the five years before the sale. The exclusion can generally be used once every two years, not on every sale.

The exclusion has a carve-out for depreciation. If part of the home was rented at any point after May 6, 1997, and depreciation was claimed on that portion, the exclusion does not cover the amount of depreciation taken. That portion is taxed separately as unrecaptured Section 1250 gain, capped at a 25 percent rate, regardless of how much of the rest of the gain the exclusion shelters.

Partial exclusions are available for sellers who do not meet the full two-year test because of a job change, health condition, or other unforeseen circumstance specified in the regulations. The partial exclusion is prorated based on the portion of the two-year period actually met, not a flat reduction.

In long-held properties or fast-appreciating markets, gain can exceed the exclusion even after basis adjustments and selling costs are applied. A home purchased for $180,000 in 1998 and sold today for $950,000, with $60,000 in documented improvements, produces gain well above the $250,000 single-filer exclusion once selling costs are netted out.

Sellers in this position sometimes ask whether a like-kind exchange can defer the gain the way it would on an investment property. It cannot, not for a property that has functioned as a personal residence. Installment sale treatment under Section 453, spreading the gain over multiple tax years as payments are received, is one option worth reviewing with a preparer in that situation.

Before 1997, the tax code allowed a homeowner to defer gain by rolling proceeds into a replacement residence of equal or greater value. That provision was repealed and replaced by the Section 121 exclusion, which does not require buying another home at all. There is no current mechanism to defer gain on a personal residence by purchasing a new one.

Section 1031 exchange treatment is reserved for property held for investment or business use. A primary residence does not qualify, even if the owner intends to buy another primary residence with the proceeds. The only path toward exchange-eligible treatment runs through a genuine, sustained conversion of the property to rental use, documented with a lease, reported rental income, and depreciation claimed on a tax return, well before a sale is contemplated.

Ready to organize the exchange file?

Share the dates, property details, and open questions for your San Diego exchange.

Start Exchange Review