How Do I Avoid Capital Gains Tax on My Second Home?

You can legally avoid or reduce capital gains tax on a second home in five main ways: move into it and qualify for the principal residence exclusion, exchange it for another investment property under Section 1031, structure the sale as an installment sale to spread the gain, drive down the taxable gain by capturing every dollar of basis and selling expense, or hold the property until death so your heirs inherit it at a stepped-up basis. Which approach fits depends on how you use the home, how long you can wait, and whether you eventually want the cash or want to pass the property on.

The stakes are real. A profit on a second home is a long-term capital gain taxed at 0%, 15%, or 20% federally, and if your modified adjusted gross income exceeds $200,000 single or $250,000 married filing jointly, an extra 3.8% Net Investment Income Tax applies on top.1Internal Revenue Service. Topic No. 559, Net Investment Income Tax Add state income tax and the combined bite on a big gain can approach 40%. That is what the strategies below are working against.

Move In and Use the Principal Residence Exclusion

The cleanest way to erase the tax is to convert the second home into your primary residence before selling. Section 121 of the Internal Revenue Code lets you exclude up to $250,000 of gain as a single filer, or $500,000 as a married couple filing jointly, if you meet both an ownership test and a use test.2Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

You need to have owned the home for at least two of the five years before the sale, and lived in it as your principal residence for at least two of those same five years. The 24 months of residency do not have to be consecutive. Ownership is almost always covered for a longtime second-home owner. The residency piece is what people underestimate.

A real conversion is not a paperwork exercise. Change your mailing address, register your vehicles, vote from the property, and file your tax returns from it. The IRS weighs the whole picture, and audits of thin, paper-only moves tend to go badly for the taxpayer.

The Non-Qualified Use Trap

Moving in does not automatically clean up the past. Any period after December 31, 2008, when the home was not your principal residence counts as “non-qualified use,” and gain has to be allocated between qualified and non-qualified periods. The non-qualified share does not get the exclusion.3Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Say you owned a beach house for ten years, rented it out for six, then moved in for four before selling. You clear the two-year use test. But six of ten years were non-qualified use, so 60% of the gain is taxable regardless of the exclusion. On a $400,000 gain, $240,000 stays taxable.

Depreciation you claimed while renting the property is worse. Any gain attributable to depreciation deductions taken after May 6, 1997, can never be excluded under Section 121. That depreciation is recaptured and taxed at a federal rate of up to 25%, reported on Form 4797.3Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Partial Exclusion If You Have to Sell Early

If a job move, a health condition, or another unforeseen circumstance defined in the regulations forces a sale before you finish two years of use, you may still get a partial exclusion equal to the maximum amount multiplied by the fraction of the 24 months you actually completed. Twelve months of residency before a qualifying job transfer, for example, gets you up to half the normal cap.2Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

Do a 1031 Exchange If It’s an Investment Property

If the second home is a rental or investment property rather than a personal getaway, Section 1031 lets you defer the entire gain by exchanging it for another investment real property. The tax is not erased; it rolls into the replacement property’s basis. Chain exchanges together and you can keep deferring until you finally sell without replacing.4Office of the Law Revision Counsel. 26 USC 1031 – Exchange of Real Property Held for Productive Use or Investment

Property held primarily for personal use does not qualify. A vacation home you use yourself and never rent out is off the table.5Internal Revenue Service. Like-Kind Exchanges Under IRC Section 1031 “Like-kind” is broad within real estate, so a residential rental can be swapped for commercial space, raw land, or any other real property held for investment.

The Two Deadlines and the Intermediary

Two clocks govern every exchange, and missing either one collapses the deferral:

You also cannot touch the proceeds. A qualified intermediary holds the funds between sale and purchase. If the money passes through your hands even briefly, the IRS treats it as a taxable sale.6eCFR. 26 CFR 1.1031(k)-1 – Treatment of Deferred Exchanges

Watch for “boot.” Any cash or non-like-kind value you receive is taxable. Trade a $500,000 property for a $400,000 replacement and pocket $100,000, and the $100,000 is taxable. Debt relief works the same way: dropping from a $200,000 mortgage to a $150,000 mortgage produces $50,000 of boot.

The Vacation Home Safe Harbor

If your second home sits on the line between personal and investment use, Revenue Procedure 2008-16 gives you a safe harbor. The IRS will not challenge the exchange if, for each of the two 12-month periods before the exchange, you rented the property at fair market rates for at least 14 days and limited your personal use to no more than 14 days or 10% of the rental days, whichever is greater. The same standards apply to the replacement property for the two years afterward.7Internal Revenue Service. Revenue Procedure 2008-16

Spread the Gain With an Installment Sale

When you cannot avoid the tax entirely, you can often spread it. In an installment sale, you finance part of the purchase yourself and the buyer pays you over time. You report the gain proportionally as payments come in, instead of all at once in the year of sale.8Office of the Law Revision Counsel. 26 USC 453 – Installment Method

This is useful when a lump-sum recognition would push you into the 20% capital gains bracket or trigger the 3.8% NIIT. Slicing the gain across multiple tax years can keep each year’s income below those thresholds and hold you at 15% or even 0%.

One trap: if you claimed depreciation, the full recapture amount is income in the year of sale, even if you have not received that much cash. Only the gain above the recapture amount can be spread across payments.9Internal Revenue Service. Installment Sales The installment method also does not apply to a sale that produces a loss.

Shrink the Gain Before You Get to Rates

Every strategy above works better when the taxable gain is smaller in the first place. Your gain equals sale price minus selling expenses minus your adjusted basis, so anything that raises basis or reduces the amount realized is money that never hits the return.

Capital Improvements Add to Basis

Improvements that add value, extend the property’s useful life, or adapt it to a new use go on your basis. Publication 523 names the usual suspects: new roof, central air, decks, kitchen renovation, security system, landscaping, and similar projects. Repairs that are part of a larger renovation count too. Routine upkeep like repainting a room or patching a faucet does not, unless it is folded into an extensive remodel.10Internal Revenue Service. Publication 523 (2025), Selling Your Home

Keep the receipts. This sounds obvious and is the single most common way owners lose money at sale. Contractor invoices, permits, and materials receipts, all in one folder or spreadsheet, protect basis additions that a decade of memory cannot.

Selling Expenses Reduce the Amount Realized

Real estate commissions, advertising, legal fees, transfer taxes, and any loan charges you paid that were normally the buyer’s responsibility all come off the sale price.10Internal Revenue Service. Publication 523 (2025), Selling Your Home On a $500,000 sale, a 5% commission alone is $25,000 of gain that disappears.

Depreciation Cuts the Other Way

If the second home was rented, your basis must be reduced by the depreciation you were allowed to take, whether or not you actually claimed it. Gain equal to that depreciation is taxed at the 25% recapture rate on Form 4797; any remaining gain gets the standard long-term capital gains rates.11Internal Revenue Service. 2025 Instructions for Form 4797 – Sales of Business Property

Pass It to Heirs Instead of Selling

If you do not actually need to convert the property to cash in your lifetime, estate planning offers the most complete elimination of capital gains tax available. The mechanism you use matters.

Gifts During Life Carry Your Basis

Gifting the home to a family member while you are alive does not erase the gain. The recipient inherits your original basis. Bought for $150,000, gifted at $600,000, and their basis is still $150,000. When they sell, they owe tax on the full $450,000 gain. You have moved the bill, not canceled it.12Office of the Law Revision Counsel. 26 USC 1015 – Basis of Property Acquired by Gifts and Transfers in Trust

The 2026 annual gift tax exclusion is $19,000 per recipient, and the lifetime gift and estate tax exemption is $15,000,000 per person following the One, Big, Beautiful Bill Act; that exemption is no longer scheduled to expire. Gifts above the annual exclusion require a gift tax return on Form 709, though no gift tax is actually owed until you cross the lifetime exemption.13Internal Revenue Service. What’s New – Estate and Gift Tax

Death Gets a Step-Up

Property passing to an heir at death takes a new basis equal to the fair market value on the date of death. All the appreciation that built up during your lifetime is permanently erased for tax purposes.14Office of the Law Revision Counsel. 26 USC 1014 – Basis of Property Acquired From a Decedent

A home purchased for $100,000 and worth $500,000 at death gives the heir a $500,000 basis. Sold immediately at that price, the taxable gain is zero. For highly appreciated real estate you do not need to sell, holding until death is the single most effective strategy available. The tradeoff is control: you keep the property, and your heirs, not you, get the proceeds.

Reporting the Sale

When the sale closes, the title company or closing agent usually issues Form 1099-S. Even if part of the gain is excluded or deferred, report the transaction. The sale details go on Form 8949, and the net gain or loss flows to Schedule D.15Internal Revenue Service. Topic No. 701, Sale of Your Home Depreciation recapture goes on Form 4797.11Internal Revenue Service. 2025 Instructions for Form 4797 – Sales of Business Property A 1031 exchange is reported on Form 8824, and the NIIT is calculated on Form 8960. A sale that shows up on a 1099-S and does not appear on your return is one of the most reliable ways to draw an IRS notice, so file the forms even when the math lands at zero tax.