Published October 27, 2026 | Last reviewed October 2026
Short answer: when you live in one unit of a duplex and rent the other, the tax code usually treats the sale as two properties. The unit you live in can qualify for the home sale exclusion under Section 121 if you meet the ownership and use tests. The rented unit is investment property, and its share of the gain can be deferred with a 1031 exchange. IRS Revenue Procedure 2005-14 shows how both rules can apply to a single sale.
Owner-occupied duplexes are a common first investment around Sacramento. You live in one side, a tenant covers part of the mortgage, and years later the property has appreciated. When it is time to sell, the question is not "1031 or home sale exclusion." It is how much of the gain belongs to each.
Why a duplex is split in two
The Section 121 regulations draw the line at the dwelling unit. Under Treasury Regulation 1.121-1(e), Section 121 does not apply to the gain allocable to any portion of the property, separate from the dwelling unit, that you did not use as your residence. If home and business use are inside the same dwelling unit, no allocation is required. A duplex is two dwelling units, so the side you rented is outside your home for this purpose.
IRS Publication 523 says the same thing in plainer words: if part of the property was used as a residence and another part, separate from the dwelling unit, was used for nonresidential purposes, only the gain allocable to the residential part is excludable.
The rental side has its own path. Section 1031(a) defers gain on real property held for productive use in a trade or business or for investment when it is exchanged for like-kind real property held the same way. The unit you rented to tenants fits that description. The unit you lived in, on its own, does not.
How Rev. Proc. 2005-14 handles it
Rev. Proc. 2005-14 addresses a single exchange where Section 121 and Section 1031 both apply. Its second example is the closest IRS illustration to a duplex. The owner had two separate dwelling units on one property, a house used as a principal residence and a guesthouse used for business. The owner allocated basis by square footage, then exchanged the whole property for a new residence plus a separate business property of equal value to the business portion given up.
The result in that example:
- The gain on the residential portion was excluded under Section 121, because the ownership and use tests were met for that portion.
- The gain on the separate business portion could not be excluded, because the owner had not used it as a residence.
- That business portion gain was deferred under Section 1031, because the replacement business property was equal in value and no boot was received.
Swap "guesthouse used as an office" for "unit rented to a tenant" and you have the basic duplex question.
The allocation step
The split is not a guess. Regulation 1.121-1(e)(3) requires you to allocate both the basis and the amount realized between the residential and nonresidential portions using the same method you used to figure depreciation, if you claimed any. Rev. Proc. 2005-14 notes that allocation by square footage is an appropriate method. By square footage, two units of equal size would split evenly, but the method you used on your returns controls.
IRS Publication 527 uses a duplex as its example of renting part of a property. It explains that shared costs such as mortgage interest and real estate taxes are divided between the rental part and the personal part, as though you owned two separate properties. The same logic carries through to the sale.
Your unit: the home sale exclusion
- The test. Section 121(a) requires that you owned and used the property as your principal residence for at least 2 years during the 5 years ending on the sale date.
- The cap. Section 121(b) limits the exclusion to $250,000 of gain, or $500,000 for certain married couples filing jointly where both spouses meet the use test.
- Depreciation. If you claimed depreciation on any part of your own unit, Section 121(d)(6) says gain from depreciation after May 6, 1997 is not excludable.
- Exchange history. If the duplex itself was acquired in a 1031 exchange, Section 121(d)(10) blocks the exclusion on a sale within 5 years of that acquisition.
The rental unit: the 1031 side
- Replacement property. The rental unit's share of the proceeds goes into like-kind real property you will hold for investment or business use.
- Deadlines. Under Section 1031(a)(3), you identify replacement property within 45 days of the sale and receive it within 180 days, or by your tax return due date if that is earlier. See how a 1031 exchange works for the full sequence.
- Depreciation. Depreciation on the rental unit is deferred along with the rest of that unit's gain when the exchange is completed. For more, see depreciation recapture and a 1031 exchange.
- Boot. In the IRS example, full deferral on the business portion came from a replacement of equal value and no cash received. Cash or debt relief tied to the rental portion can create taxable boot.
Three common duplex scenarios
You still live in one unit when you sell
This is the split described above. Your unit is tested under Section 121. The rental unit can go into a 1031 exchange. Escrow and your intermediary need to know at the start that only part of the proceeds is exchange money.
You moved out and rented both units
Now both units are rentals at the time of sale, and the whole property may be held for investment. Your former unit may still pass the 2 out of 5 year test if you moved out recently enough. That timing question is covered in lived in it, then rented it.
You want to move into the replacement
Section 1031 requires the replacement to be held for investment or business use. A unit you plan to live in does not meet that description on its face. If the plan is to buy another duplex and occupy one side, have your CPA review how the replacement value is allocated before you sign.
Before you list
- Pull the depreciation schedules from past returns. They show the allocation method already in use.
- Count your own occupancy dates against the 5 years before your planned closing.
- Line up a qualified intermediary before closing, not after, for the rental unit's share.
- Ask a CPA to run both sides: the excluded gain on your unit and the deferred gain on the rental.
If you are still deciding whether to sell, keep or sell walks through the tradeoffs. For the California side of the bill, see California taxes when selling a rental. To find an intermediary or CPA, you can request a referral.
Common questions
Can I use a 1031 exchange if I live in one unit of my duplex?
Usually for the rented unit, yes. The unit held for investment can be exchanged under Section 1031. The unit you live in is a personal residence and is handled under the Section 121 home sale exclusion instead.
How is the gain split between my unit and the rental unit?
Treasury Regulation 1.121-1(e)(3) requires you to allocate basis and sale price using the same method you used for depreciation. Rev. Proc. 2005-14 says square footage is an appropriate method.
Can I exclude gain on the rental side of my duplex?
Generally no. The rented unit is a separate dwelling unit, and Section 121 does not apply to gain on a separate portion you did not use as your residence. A 1031 exchange may defer that gain instead.
Does depreciation on the rental unit get taxed when I sell?
If the rental unit's share goes through a completed 1031 exchange, the gain, including depreciation, is deferred. Depreciation claimed on your own unit after May 6, 1997 cannot be excluded under Section 121.
Sources
- IRS, Internal Revenue Bulletin 2005-7, Rev. Proc. 2005-14
- 26 CFR 1.121-1, Exclusion of gain from sale or exchange of a principal residence
- 26 U.S. Code Section 121
- 26 U.S. Code Section 1031
- IRS Publication 523, Selling Your Home
- IRS Publication 527, Residential Rental Property
Sources checked October 27, 2026. Last reviewed October 2026.
General information only, not tax or legal advice. Consult a CPA or tax attorney.