Can you avoid capital gains by buying another home?

So I sold my house last month and made a decent profit. A friend told me that if I buy another home right away I don't have to pay capital gains on the sale, like a rollover or something. I've been trying to figure out if this is still a thing because I keep seeing mixed info online. Some sites say it ended years ago, others make it sound like it's still possible. I already lived in the house for about 6 years so I'm not sure if that matters. I haven't filed anything yet and want to understand the actual rule before I do something wrong. Can you avoid capital gains by buying another home, or is my friend just remembering something old?

34 comments

Your friend is remembering a rule that was repealed back in 1997. The old rollover rule — where you could defer gain by buying a more expensive home — no longer exists. What replaced it is a straight exclusion. If you owned the home and used it as your main residence for at least 24 months out of the 5 years before the sale, you can exclude a portion of the gain outright. The buying-another-home part has nothing to do with whether you qualify or how much you exclude. Publication 523 on irs.gov has the full eligibility test.

Darius J.

Author

So there's no reinvestment requirement at all? You just have to have lived there long enough?

Correct. No reinvestment required. You either meet the ownership and use test or you don't. What you do with the proceeds is irrelevant to the exclusion.

Went through this last spring. I uploaded my closing disclosure and old purchase documents to taxr.ai and it walked through exactly which years counted toward my ownership and use period, flagged that I'd rented the place out for a stretch, and showed me which part of my gain was still excludable versus what I'd owe tax on. Saved me from assuming the whole gain was excluded. The IRS page for Publication 523 lays out the eligibility test in steps if you want to check it yourself.

Darius J.

Author

Did the rental period actually reduce your exclusion? I never rented mine out so hopefully that's not an issue for me.

It can, depending on when the rental was and whether depreciation was involved. Since you didn't rent yours out, your situation is cleaner. Just confirm you hit the 24-month ownership and use thresholds.

People mix this up with the 1031 exchange rule, which is real but only applies to investment or business property, not your personal residence. If you had a rental property or land held for investment, a 1031 lets you defer gain by rolling into a like-kind property. For a home you lived in, that's not available, and even if it were, there's a 5-year lookback that would block the home sale exclusion afterward.

Wait, so if someone did a 1031 on a property and then moved into it, they still can't use the home sale exclusion?

Not if the 1031 happened within the past 5 years before the sale. Publication 523 covers that specific restriction. The exclusion is off the table in that window.

My parents thought the same thing when they sold their house. They were convinced buying a condo right away would zero out their tax. It didn't. What actually happened was their gain fell under the married filing jointly exclusion limit because they'd both lived there for years, so they owed nothing anyway — but that was luck, not the reinvestment strategy.

I sold a rental I'd converted to my main home a few years back, messy situation with partial exclusion. I gave Taxr all my closing statements, the depreciation schedules from when it was a rental, and my date-of-residence records, and it built out the worksheet showing exactly how much of the gain was excludable and how much was unrecaptured Section 1250 gain taxed differently. I cross-checked the numbers with my CPA and they matched. The key thing for your situation is that the exclusion amount for single versus married filers differs — check Publication 523 for the actual figures.

Darius J.

Author

Is the unrecaptured depreciation thing something I need to worry about if I never rented it and never claimed depreciation?

If you never took depreciation on it and always used it as your personal residence, Section 1250 recapture shouldn't apply to you. Your question is really just about whether your gain clears the standard exclusion.

The 24 months don't have to be consecutive, which trips people up. You can have moved out for a bit and moved back and still hit the threshold as long as the total use adds up to 24 months within the 5-year lookback window. Just make sure you can document the dates.

Darius J.

Author

I lived there the whole 6 years without leaving, so I think I'm fine on that front.

Worth noting: if your gain is above the exclusion limit, buying another home does not reduce or defer the taxable portion in any way. That excess gets reported on Form 8949 and flows to Schedule D as a long-term capital gain (assuming you held more than a year). The rate depends on your income for the year, not on what you spend the proceeds on.

Did you get a Form 1099-S from the closing? That changes what you're required to report regardless of whether you have a taxable gain.

Darius J.

Author

I don't think I did. The title company didn't send anything like that.

If no 1099-S was issued and your entire gain is excluded, Publication 523 says you generally don't need to report the sale at all. But if any gain is taxable you report it on Form 8949 even without the 1099-S.

The holding period matters too. For the capital gain rate — not the exclusion — you need to have held the home more than one year for it to be long-term. Counting starts the day after the date you acquired it and ends on the date you sell. Six years easily clears that, so whatever taxable portion you have (if any) would be long-term.

Something my accountant told me: even if your gain is fully excluded, you still need to track your basis carefully in case you ever sell a future home and need to account for any basis adjustments from this one. Probably not relevant here but worth keeping records.

Are there situations where a gain from an old sale affects basis on a new one?

Worksheet 2 in Publication 523 mentions adjusting basis for gain postponed from a home sold before May 7, 1997. For anything after that date under current rules it doesn't carry over, but document everything anyway.

The exclusion is per-sale, not per-year. You also can't use it if you excluded gain on another home sold within the 2-year period before this one. So if you sold a different home recently and already claimed an exclusion, that could limit you here.

Darius J.

Author

This is my first home sale ever so I'm not in that situation, but good to know.

Real estate agents sometimes still tell buyers that buying up protects you from gains. It's just outdated advice. The rule your friend described was Section 1034, which the Taxpayer Relief Act of 1997 replaced with the current exclusion. No reinvestment required, no deferral, just an outright exclusion if you qualify.

If your gain is high enough that even after the exclusion there's still a taxable amount, and your income puts you in the higher bracket, you might also face the Net Investment Income Tax on top of the regular capital gains rate. That's worth running through with a CPA or enrolled agent before you file if the numbers are significant.

Darius J.

Author

How do I know if that applies to me?

It depends on your modified adjusted gross income for the year — the threshold varies by filing status. The Form 8960 instructions on irs.gov lay out exactly who it hits. If the taxable gain is large I'd really recommend sitting with an enrolled agent rather than guessing.

Fully excluded gains don't just disappear from recordkeeping. Keep your HUD-1 or closing disclosure from the purchase, any receipts for capital improvements you made, and the closing disclosure from the sale. Those documents establish your basis and your proceeds if you ever get questions.

To clarify one thing I saw implied earlier: a 1031 exchange absolutely cannot be used for a primary residence. It's specifically for property held for productive use in a trade or business or for investment. Using your home doesn't meet that test even if you made a lot of money on it.

Does the partial exclusion rule help anyone who doesn't fully meet the 2-year test?

Yes, if you sold early because of a job relocation, a health issue, or what the IRS calls an unforeseen circumstance, Publication 523 describes a partial exclusion. The amount is prorated based on how much of the 2-year period you actually used the home.

Darius J.

Author

I definitely meet the full test so this doesn't apply to me, but useful to know for others.