How to Defer Capital Gains Tax on Your Primary Residence

If you’re selling your home and want to keep the IRS out of the profit, the main way to defer capital gains tax on a primary residence is to eliminate most or all of the gain up front with the Section 121 exclusion, then use an installment sale, a rental conversion followed by a 1031 exchange, or a Qualified Opportunity Fund investment to push any remaining tax into later years. The exclusion alone erases up to $250,000 of gain for single filers and $500,000 for married couples filing jointly, which covers the vast majority of home sales outright. The deferral tools matter when your profit runs above those ceilings.

Start With the Section 121 Exclusion

Before reaching for any deferral strategy, run your sale through the Section 121 exclusion. A single filer can exclude up to $250,000 of gain, and a married couple filing jointly can exclude up to $500,000, if two tests are met.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

The ownership test asks whether you owned the home for at least two of the five years immediately before the sale. The use test asks whether you lived in it as your primary residence for at least 24 months during that same five-year window. Those 24 months don’t have to be consecutive. For joint filers going after the full $500,000, either spouse can meet the ownership test, but both must independently meet the use test. You also cannot have used the exclusion on another home sale in the two years before this one.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Any stretch of time after December 31, 2008, when the property was not your primary residence counts as “nonqualified use,” and the portion of gain tied to those years cannot be excluded. Short absences of two years or less for a job move, health issue, or unforeseen event are exceptions.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Partial Exclusion If You Sell Early

Selling before the two-year marks doesn’t automatically kill the benefit. If the move was driven by a qualifying job relocation, a health condition, or certain unforeseen circumstances, you get a partial exclusion proportional to the months you did live there.2Internal Revenue Service. Publication 523 – Selling Your Home For a work move, the new job location must be at least 50 miles farther from the home than the previous workplace. Divide the months you lived in the home by 24, then multiply by the full exclusion. Eighteen months of residency as a single filer supports up to $187,500 of excluded gain.

Shrink the Gain Before You Try to Defer It

Every deferral tool below works on whatever profit remains after the exclusion. Reducing the gain itself is often the highest-leverage move, and it costs nothing but recordkeeping.

The IRS calculates gain as selling price minus selling expenses (that’s the amount realized), then amount realized minus your adjusted basis.2Internal Revenue Service. Publication 523 – Selling Your Home Two levers lower the number.

Capital improvements add to basis. Adding a bathroom, replacing a roof, installing central air, building a deck, putting in a new fence or driveway, and modernizing a kitchen all count. Routine repairs do not, though repairs done as part of a broader remodel can qualify.3Internal Revenue Service. Publication 523 – Selling Your Home Over a decade or two of ownership, $50,000 to $100,000 of documented improvements is common, and each dollar reduces gain dollar for dollar. Keep receipts, contractor invoices, and permits.

Selling expenses come off the top before the gain is even measured. Real estate commissions, legal fees, advertising, and any loan charges you paid for the buyer all count. Original settlement costs like title insurance, recording fees, survey costs, and transfer taxes get added to basis. Mortgage-related charges from the purchase (appraisal, origination points, mortgage insurance) do not.2Internal Revenue Service. Publication 523 – Selling Your Home

Spread the Tax With an Installment Sale

When your gain exceeds the exclusion, an installment sale spreads the tax across multiple years instead of piling it into one. You finance the sale yourself: the buyer pays over time, and at least one payment must arrive after the close of the tax year in which the sale occurs.4Office of the Law Revision Counsel. 26 USC 453 – Installment Method

You compute a gross profit ratio by dividing total gain by total contract price. A $1,000,000 sale price with a $400,000 gain gives a 40% ratio. Each year you owe capital gains tax on 40% of the principal payments received that year.4Office of the Law Revision Counsel. 26 USC 453 – Installment Method Keeping annual income lower can also keep you in a lower capital gains bracket than a single-year lump would have triggered.

Interest on the loan is taxed separately as ordinary income. You must charge at least the applicable federal rate, which the IRS publishes monthly. Charge less and the IRS recharacterizes part of the principal as imputed interest.5Internal Revenue Service. Topic No. 705 – Installment Sales Expect to draw up a formal promissory note and record a deed of trust to secure your position in the property.

Convert to a Rental, Then Do a 1031 Exchange

A 1031 exchange defers gain by rolling proceeds into another investment property, but it does not apply to your primary residence. Section 1031 is limited to real property held for business or investment.6Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment To get there, you have to convert the home into a genuine rental first.

The IRS safe harbor in Revenue Procedure 2008-16 lays out the minimums. Own the property for at least 24 months before the exchange. In each of those two 12-month periods, rent it at fair market value for at least 14 days, and hold your personal use to no more than the greater of 14 days or 10% of the days it was rented.7Internal Revenue Service. Revenue Procedure 2008-16 Report the rental income on Schedule E to establish investment character.

Once you’re in exchange territory, the deadlines are unforgiving. Use a Qualified Intermediary to hold the sale proceeds; touching the funds yourself destroys the deferral. Identify replacement properties in writing to the intermediary within 45 days of closing. Close on the replacement within 180 days of the original sale, or by your tax return due date for that year, whichever is earlier.6Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment Miss either date and the whole gain becomes taxable that year.

To defer the full gain, the replacement property needs equal or greater value and equal or greater debt. Any shortfall (called “boot”) gets taxed in the exchange year. Some sellers pair Section 121 and Section 1031: they exclude up to $250,000 or $500,000 on the residence portion and defer the rest through the exchange.

Watch Out for Depreciation Recapture

While the home is a rental, you must claim depreciation each year. When you eventually sell, the IRS recaptures that depreciation at a flat 25% rate no matter your income bracket, and this applies even if you complete a 1031 exchange for the remaining gain.8Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5 Three years of rental producing $30,000 of depreciation means roughly $7,500 of recapture tax. Price that in before converting.

Invest the Gain in a Qualified Opportunity Fund

A Qualified Opportunity Fund invests in designated low-income areas and lets you defer capital gain by putting the profit portion (not the whole sale price, unlike a 1031) into a certified fund within 180 days of the sale.9Office of the Law Revision Counsel. 26 USC 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones

Congress rewrote this program in the One Big Beautiful Bill Act of July 2025. For gains invested before January 1, 2027, the older framework still governs: the deferred gain is recognized on the earlier of the date you sell your fund interest or December 31, 2026. Investing during 2026 leaves essentially no deferral runway.

For gains invested on or after January 1, 2027, a rolling five-year deferral kicks in. The deferred gain is included in income on the earlier of the sale of your fund interest or five years after the investment date.9Office of the Law Revision Counsel. 26 USC 1400Z-2 – Special Rules for Capital Gains Invested in Opportunity Zones The old 15% basis step-up at seven years is gone. A 10% basis increase after five years remains. A new Qualified Rural Opportunity Zone category offers a 30% basis increase for investments in designated rural areas.

The strongest piece of the program survives: hold the fund investment for at least ten years and any appreciation on the fund itself can be excluded from tax when you sell. Beyond 30 years, basis is frozen at fair market value as of the 30-year mark. Opportunity Zone investments go on Form 8949 and Form 8997.10Internal Revenue Service. Sale of Residence – Real Estate Tax Tips

Don’t Forget the 3.8% Net Investment Income Tax

Even after Section 121, high-income sellers may owe a 3.8% surtax on the portion of gain that isn’t excluded. The Net Investment Income Tax applies when your modified adjusted gross income exceeds $250,000 for married joint filers, $200,000 for single filers, or $125,000 for married filing separately.11Internal Revenue Service. Net Investment Income Tax Gain you successfully exclude under Section 121 is not counted. Only the non-excluded portion, combined with your other income, is measured against the thresholds. On an expensive property, this stacks meaningfully on top of the standard capital gains rate.

Reporting the Sale

Not every sale generates IRS paperwork. If the closing agent gets a written certification from you that the home was your primary residence and the full gain is excludable, they don’t have to file Form 1099-S. The certification requires a sale price of $250,000 or less for single filers, or $500,000 or less for those certifying as married, and no period of nonqualified use after 2008.12Internal Revenue Service. Instructions for Form 1099-S – Proceeds From Real Estate Transactions

If you receive a 1099-S, or if any portion of the gain is taxable, report the sale on Form 8949 and carry totals to Schedule D.10Internal Revenue Service. Sale of Residence – Real Estate Tax Tips Hold onto utility bills, mortgage statements, voter registration, and property tax receipts from the years you lived in the home. If the IRS ever questions the exclusion, that paper trail makes the answer easy.