Can I avoid capital gains selling rental to put money into primary home?

Trying to figure out if there's a way to shelter the gain on my rental when I sell it. I've owned the rental for about 6 years and it's appreciated a good amount. My plan is to take the proceeds and use them toward paying down or renovating my primary home. I keep reading about 1031 exchanges but those seem to require buying another investment property, not a personal residence. I also looked at the home sale exclusion but I think that's only for your main home. Is there any strategy that actually lets you avoid capital gains selling rental to put money into primary home? Or am I stuck paying the full tax on the gain? Already talked to one person who said "just do a 1031" but that doesn't help if I want the money for my house.

36 comments

Short answer: no clean path exists that lets you sell a rental and put the money into your primary home tax-free. The two big tools—the section 121 exclusion and the 1031 exchange—each block you here. Section 121 (the home sale exclusion) only covers your main home. The ownership and use tests both have to be met for the property you're selling, not the one you're buying into. Your rental doesn't qualify unless you convert it to your primary residence first and meet the time requirements. Section 1031 defers gain only if you reinvest into another property held for investment or productive use in a business. A personal residence doesn't qualify as the replacement property.

Omar L.

Author

So the 1031 thing I keep hearing about is completely useless for my goal here? Even if I did one, I'd just end up with another rental I don't want?

Exactly. 1031 just kicks the gain to the next property. You'd have to keep it as investment property or you'd eventually recognize the gain anyway when you sell without another exchange.

There's one angle worth thinking about: converting the rental to your primary residence before selling. If you move in and live there long enough to meet the ownership and use tests under section 121, you can exclude a chunk of the gain. But it's not that simple because there are two limitations that eat into the exclusion—depreciation recapture is never excluded (that gets taxed as unrecaptured section 1250 gain at a maximum 25% rate, not as ordinary income), and any period after 2008 during which the property was used as a rental is treated as "nonqualified use" and that portion of the gain stays taxable.

Omar L.

Author

How long would I need to live there before I could sell and use the exclusion?

You need 24 months of ownership and 24 months of use as your main home within the 5 years before the sale. The 24 months don't have to be consecutive. But the nonqualified use fraction will still apply to the years it was a rental, so the exclusion only shelters a piece of the gain, not all of it.

The depreciation recapture part trips up a lot of people. Even if you qualify for the exclusion after converting, unrecaptured section 1250 gain from the depreciation you claimed (or should have claimed) gets taxed separately. It doesn't disappear just because you now live there.

Sold a rental a couple years back. No magic trick. I paid capital gains on the appreciation and depreciation recapture on top of that. The depreciation recapture rate can be higher than you expect—look at the unrecaptured section 1250 gain rules and the instructions for Schedule D and Form 4797. What you do with the cash after the sale (pay down your mortgage, renovate, whatever) doesn't affect your tax bill at all.

Omar L.

Author

Did you try any kind of installment sale or anything like that to spread the gain out?

I looked at installment sales. Spreads the gain across years as you receive payments, which can help if it keeps you in a lower bracket. But only works if the buyer actually pays you over time—you can't do an installment sale if you get the full amount at closing.

I uploaded my sale documents and depreciation schedules to taxr.ai and had it walk through Form 4797 and Schedule D line by line for my situation. It flagged exactly how much of my gain was section 1250 recapture versus regular long-term capital gain, and drafted a summary showing what each piece would look like on my return. Helped me see clearly where the actual tax hit was coming from before I talked to my CPA.

Omar L.

Author

Did it account for the nonqualified use stuff too or just the basic gain?

It read through the depreciation history and the dates. For a conversion scenario it laid out the nonqualified use fraction calculation. I still had my CPA review everything but going in with that breakdown already done made the conversation a lot faster.

Nobody mention the qualified opportunity zone route yet? Your rental doesn't have to be in or near a designated opportunity zone—there's a separate deferral mechanism where you invest the realized gain into a Qualified Opportunity Fund. Doesn't help with the goal of putting money into your primary home directly, but it's another deferral option some people overlook.

Worth flagging: the original QOZ deferral deadline already passed for new investments getting the basis step-up benefits, so the picture looks different than it did a few years ago. You'd want to check current IRS guidance on what benefits still apply to new QOF investments before treating this as a full solution.

To be clear about the installment sale point raised above: you can elect out of installment treatment by reporting the whole gain in the year of sale on Form 4797 or Schedule D instead of filing Form 6252. But if you use installment method and later receive a lump sum, there are rules about how that's treated. The IRS instructions for Form 6252 walk through the reporting. Main thing is it spreads recognition, not avoidance—you still pay tax on all of it eventually.

Before my rental sale closed I ran my depreciation schedule and the projected sale numbers through Taxr. It put together a worksheet comparing the installment sale method against recognizing everything in the year of sale, showing the Form 4797 ordinary income piece separately from the Schedule D capital gain piece. That comparison is what made me decide to take the full hit in one year rather than dragging it out. My enrolled agent double-checked the numbers and they matched.

Omar L.

Author

Was the Form 4797 piece a lot bigger than you expected?

Honestly yes. The unrecaptured section 1250 gain was more than I had mentally accounted for because I hadn't tracked how much depreciation I'd claimed over the years carefully. If you haven't added up your cumulative depreciation deductions from all prior Schedule E filings, do that now before you assume most of your gain is just regular long-term capital gain.

One thing that actually can help in some cases: if your income is low enough in the year of sale, some of your long-term capital gain might be taxed at 0%. That doesn't eliminate it but it changes the math. The rates depend on your taxable income and filing status—check the Schedule D tax worksheet in the instructions for the current year. Depreciation recapture still gets its own rate treatment regardless.

This is real but most people selling an appreciated rental aren't going to have low enough income to get the 0% rate. The gain itself counts in your income, which pushes a lot of people up into higher brackets than they expect for the year of sale.

Coming at this from a different angle—have you thought about refinancing your primary home instead of selling the rental? If you need cash for the primary home, a cash-out refinance or HELOC on either property could get you the funds without triggering a sale. You keep the rental, keep deferring the gain, and get the liquidity you wanted. Interest deductibility is its own calculation but at least you're not creating a taxable event.

Omar L.

Author

That's actually an interesting workaround. Does the rental loan interest stay deductible as a rental expense then?

If you use the loan proceeds for the rental property itself, the interest is a rental expense on Schedule E. But if you pull equity from the rental and use it for your personal home, the interest tracing rules apply and it likely becomes personal interest, which isn't deductible. The allocation depends on how the proceeds are actually used.

Don't overlook state taxes either. The federal capital gains rules are one thing but several states don't have preferential rates for long-term gains—they tax it as ordinary income at the state level. If you're in one of those states the total hit is significantly higher than just the federal numbers suggest.

Wanted to push back gently on the conversion strategy. Yes it works in theory but moving into your rental has real costs and life disruption. Run the actual numbers: how much gain does the section 121 exclusion cover after the nonqualified use fraction is applied? Is the tax savings bigger than the cost of the move, the disruption, waiting potentially years before selling, and the opportunity cost of your capital being locked in the property? For many people the math doesn't favor the conversion.

Agreed. The conversion strategy makes more sense if the rental is close to your primary home in location or if you were already planning to downsize into it. Pure tax motivation alone rarely pencils out once you count all the costs.

Form 4797 is the one that handles the sale of business property including rental real estate. The gain is figured in Part III of Form 4797, but for a straight-line residential rental there's generally no ordinary-income recapture—the depreciation is unrecaptured section 1250 gain taxed at up to 25%—and the gain goes to Part I and from there to Schedule D as long-term. If you've been filing Schedule E for this rental and claiming depreciation each year, all of that accumulated depreciation comes back through 4797 when you sell. The IRS instructions for Form 4797 lay out the line-by-line flow.

Omar L.

Author

So the Part III ordinary income piece doesn't get the preferential long-term rate at all?

Not quite. Unrecaptured section 1250 gain (the depreciation on real property) gets its own rate—look at the Schedule D tax worksheet and the qualified dividend and capital gain tax worksheet in the Form 1040 instructions. It's not taxed as regular ordinary income at your marginal rate but it's not the same as your standard long-term capital gain rate either. The instructions step you through it.

The IRS has a plain-language page on Topic no. 409 at irs.gov covering capital gains and losses, and Publication 550 covers holding periods and gain calculation in detail. If you want the home sale exclusion rules specifically, Publication 523 is the right place—it has the eligibility test, the nonqualified use rules, and worked examples. Worth reading those before you assume any particular strategy works for your facts.

Has anyone done a 1031 into a different rental and then later converted that replacement property into their primary residence? Curious whether the gain deferred in the 1031 ever gets excluded under section 121 when you eventually sell.

There's a specific rule for this. If you acquired the replacement property in a 1031 exchange and later try to sell it as your main home using the section 121 exclusion, the 1031 history matters, and nonqualified use for the rental years can still limit how much you exclude. Also, a home acquired through a section 1031 like-kind exchange within the 5 years before the sale doesn't qualify for the exclusion at all under the current rules. Publication 523 covers this specifically.

So you'd need to have held the replacement property more than 5 years before selling it as a primary residence, and even then nonqualified use for the rental years would limit the exclusion? That's a pretty narrow window for that strategy to do much.

Circling all of this back to the original question: there is no provision in the tax code that lets you sell a rental property and avoid the capital gain simply by putting the proceeds into your primary home. The use of the sale proceeds after closing is irrelevant to whether a gain is recognized. Your options are defer via 1031 (but you need a replacement investment property), convert to primary residence and partially exclude after meeting the time tests (with nonqualified use limiting how much), installment sale to spread the gain over years, or hold the rental and access its equity through financing instead.

Omar L.

Author

This is a really clear summary of where I actually stand. I think the conversion option is the one worth modeling properly with actual numbers before I make any decisions. I'll pull all my prior Schedule E returns to get the cumulative depreciation first.