How to avoid capital gains when selling rental duplex owned for years

Trying to figure out how to avoid capital gains when selling rental duplex owned for years — we bought it in 2011 and have fully depreciated most of it. Tenant on one side, we lived in the other side until 2019. Now we want to sell and the gain is pretty large. I know there's something with the primary residence exclusion but I haven't lived there in a while. I've also heard about 1031 exchanges but we're not sure we want another property. The 1099-S is going to show the full proceeds. Our CPA retired and I haven't replaced her yet. Main questions: how much of the gain can actually be sheltered, and what should I be thinking about before we close escrow? Already pulled Schedule D and Form 8949 from last year's return to understand the basis side.

39 comments

Schedule D and Form 8949 are the right starting points. The big wrinkle here is depreciation recapture — all those years of depreciation deductions come back as unrecaptured section 1250 gain (taxed at up to a 25% rate) when you sell, and that piece cannot be excluded under the home sale exclusion, though a 1031 can defer it. That's separate from the capital gain portion, so you're really looking at two different tax problems in one sale.

Rachel W.

Author

Thanks, I suspected the recapture was its own animal. So even if I shelter the gain somehow, the recapture is still there no matter what?

Correct. A 1031 exchange defers the recapture into the replacement property's basis, it doesn't eliminate it. If you sell without exchanging, the straight-line depreciation on the rental comes back as unrecaptured section 1250 gain taxed at up to 25%, and it's not going anywhere.

The partial exclusion situation is complicated here. You used one unit as your main home through 2019, so there's an allocation question — the exclusion under Publication 523 only covers the residential portion, not the rental unit. The IRS treats a duplex where you occupied one side as a mixed-use property, so only your half of the gain from your side can even be tested against the exclusion rules.

Rachel W.

Author

So I'd need to split the gain between my unit and the tenant's unit and only the my-side gain gets tested against the two-year rule?

Essentially yes, and then within your side you also have to strip out the depreciation recapture on your unit if you ever took depreciation on it. Publication 523 has the worksheet for figuring the allocable gain.

I uploaded my closing disclosure, old HUD-1 from purchase, and all my Schedule E's to taxr.ai and it reconstructed the adjusted basis year by year — showed me exactly how much cumulative depreciation was sitting there before I even called a CPA. Worth doing before you close so you're not surprised. On the exchange question: a 1031 is the main tool for deferring the capital gain piece, but you've got the 45-day ID window and the 180-day close window once your relinquished property closes, so the timeline pressure is real.

Rachel W.

Author

Good idea on the basis reconstruction. I have the original HUD-1 and every Schedule E. Did Taxr also show how the recapture was split between the units?

It did — it traced the depreciation from each Schedule E line and flagged that the owner-occupied unit had different treatment once I stopped claiming depreciation on it. Saved a lot of back-and-forth with a preparer.

One thing to nail down before escrow: your cost basis needs to include every capital improvement — new roof, HVAC, anything added to the structure. Those increase basis and reduce your gain directly. Pull permits, contractor invoices, whatever you have. The 1099-S will show gross proceeds and that's it, basis is on you.

Rachel W.

Author

We did a full kitchen reno on the rental side in 2017. I have the invoices. I'll add that to the adjusted basis worksheet.

1031 exchange has to be set up before closing, not after. You need a qualified intermediary (QI) in place and the exchange agreement signed before the sale proceeds ever touch your hands. If you close and take the cash, the exchange is dead. This is a step people miss.

Has anyone here done a 721 exchange into a REIT umbrella partnership? I've been reading about it as an alternative to 1031 when you don't want to manage another property, but the tax treatment seems complicated and not every REIT accepts individual investors this way.

721 exchanges are real but very fact-specific and the UPREIT has to accept your property at a value they agree on. The tax deferral works differently from a 1031 and there are restrictions on when you can convert the OP units to REIT shares. Worth a conversation with a tax attorney or CPA who specializes in real estate transactions, not a DIY situation.

Fair point, I'll bring it up with a CPA. I was just trying to avoid buying another active rental.

Form 4797 is where the depreciation recapture actually gets calculated and reported, specifically Part III for property held more than a year. The unrecaptured Section 1250 gain flows from there to the Schedule D worksheet, and that's the piece taxed at the 25% rate (for taxpayers in the brackets where that applies — check the Schedule D instructions for the Unrecaptured Section 1250 Gain Worksheet). I had Taxr walk through my own Form 4797 from a rental sale last year and it flagged that my preparer had the wrong depreciable basis in Part III, which would have overstated the recapture amount.

Rachel W.

Author

This is exactly what I'm worried about — the basis being wrong in Part III. I'll have someone check it before filing.

The depreciable basis in Part III needs to be only the building value (not land) allocated to the rental unit, reduced by any Section 179 or bonus depreciation taken. If you have both units, only the rental unit's depreciation hits 4797 as recapture; your residential unit's depreciation (if any) has its own treatment.

If you're not doing a 1031 and the gain is large, talk to an enrolled agent or CPA about installment sale treatment under Form 6252. Spreading the proceeds over multiple years won't eliminate the gain but it can spread the tax hit, which matters if a lump gain would push you into a higher bracket or affect other phase-outs. The straight-line depreciation piece on a rental is unrecaptured section 1250 gain, which is reported as payments come in (taken first), so it spreads too.

Rachel W.

Author

Wait, so the depreciation piece spreads too on installment? That's a critical point. So installment sale helps both the capital gain portion and the depreciation piece?

Correct. Under the installment rules, only ordinary Section 1250 recapture income (depreciation beyond straight-line) is reported in the year of sale; unrecaptured Section 1250 gain from straight-line depreciation is reported as payments come in, ahead of the rest of the capital gain. This is in the Form 6252 instructions.

The two-year residency test for the exclusion under Publication 523 looks at the five years before the sale date. You left in 2019 and if you're selling now, that's more than five years ago, so you won't meet the use test on the residential unit anyway. The window has closed. The exclusion is off the table unless you moved back.

Rachel W.

Author

Ugh, that's what I was afraid of. We talked about moving back in for a year but it felt forced. So no exclusion at all at this point?

If you haven't lived there as your main home for 24 of the last 60 months before the sale, you don't meet the use test. Publication 523 lays out the eligibility test step by step. No partial exclusion either unless the reason for selling fits a qualifying exception like a job change or health issue.

Opportunity Zone investment is another deferral route — you roll the capital gain (not the full proceeds, just the gain) into a Qualified Opportunity Fund within 180 days of the sale. The deferral and potential reduction rules have changed over the years, so check the current IRS Opportunity Zones guidance and the Form 8997 instructions for what still applies in the year you sell. Recapture isn't deferred this way either.

Opportunity Zones are worth looking at but the program's benefits have changed significantly since the original 2017 legislation. Have a CPA or tax attorney model the numbers for your specific gain amount before committing — the fund quality varies a lot too.

Something people underestimate: state taxes. If your state has its own capital gains tax or recapture rules, the federal deferral strategies don't necessarily carry over. A 1031 that works federally might still trigger state tax depending on where the property is. Worth confirming with a CPA who knows your state.

I sold a long-held rental a couple years ago and the basis allocation between land and building was the piece that tripped my preparer up. I uploaded the original appraisal, the settlement statement, and Schedule E from the first year we rented it to Taxr, and it laid out a clear summary of how the land vs. building split should flow through to Form 4797 Part III — made it easy to hand to my CPA for review. That land piece never gets depreciated and doesn't create recapture, so getting it right really matters.

Rachel W.

Author

Thank you — I actually don't have a formal appraisal from 2011. Would a tax assessor's allocation work as a substitute?

Tax assessors routinely break out land vs. improvement value and the IRS generally accepts that allocation if you used it consistently from the start. If you didn't track it that way, an enrolled agent or CPA can help you document a reasonable allocation before you file.

Form 8949 will need an entry for the sale of your own unit — long-term since you've held it over a year, so Part II, box F since it came on a 1099-S rather than a 1099-B; the rental unit's share goes on Form 4797 instead. The proceeds from the 1099-S go in column (d). Your adjusted basis in column (e). The gain flows to Schedule D line 10, and the 4797 gain flows to Schedule D line 11 and through the Unrecaptured Section 1250 Gain Worksheet depending on how the 4797 gain is classified.

Rachel W.

Author

Got it. So the 1099-S amount for my unit is column (d), my reconstructed adjusted basis is column (e), and the rental unit's share, including the depreciation piece, goes on 4797?

Mostly yes, but be careful — the proceeds and basis split between the 8949 entry for your unit and the 4797 entry for the rental unit have to add back to the 1099-S total. The 4797 handles the rental unit's gain, including the depreciation portion, and its net gain flows to Schedule D alongside your unit's gain. Your software or preparer should tie those together.

If the gain is large enough that you're weighing all these options, honestly get a CPA or enrolled agent involved before you close, not after. Post-closing you lose the 1031 option and there's nothing to do except file correctly. Pre-closing you still have decisions to make.

Rachel W.

Author

100% agree. I'm actively looking for a new CPA. This thread has given me a solid list of questions to bring.

Publication 550 covers the holding period rules — for property held more than one year the gain is long-term, which is relevant to what rate applies to the capital gain portion (separate from the 25% recapture rate). The holding period starts the day after acquisition and ends on the sale date. At 14 years you're clearly long-term, but it matters for which lines on Schedule D your gain lands on.

Don't forget estimated taxes if the sale closes this year. A large gain in a single quarter can create an underpayment penalty if you're not making quarterly payments to cover it. That's separate from planning the gain itself — just a cash-flow thing to stay ahead of.

Rachel W.

Author

Good reminder. I hadn't thought through the quarterly side of this. I'll flag it when I talk to a CPA.

To pull together what this thread has covered: depreciation on the rental comes back as unrecaptured Section 1250 gain taxed at up to 25%, exclusion is off the table based on the timeline, 1031 is the main capital gain deferral tool but needs a QI before closing, installment sale under Form 6252 can spread the gain including the straight-line depreciation piece, and basis reconstruction is the foundation for all of it. Get a CPA or enrolled agent before you close.