Primary Residence and 1031: Using Section 121 With an Exchange
A property that has been both your home and a rental can use two tax breaks in one transaction. Section 121 excludes up to $250,000 of gain ($500,000 for qualifying joint filers) if you owned and lived in it as your main home for 2 of the 5 years before the sale. Section 1031 defers the rest, including the depreciation gain that §121 can’t touch. Rev. Proc. 2005-14 sets the order: apply §121 first, then §1031.
The rules that make it work
Rev. Proc. 2005-14 §4.02 says §121 is applied to the realized gain before §1031. Gain from depreciation after May 6, 1997 isn’t excludable under §121(d)(6), but §1031 can defer it. And cash or other non-like-kind property you receive is taken into account only to the extent it exceeds the gain excluded under §121.
Under §4.03, basis in the replacement property is increased by the excluded gain, which is treated as if it were recognized.
The procedure only applies if the property qualifies for both. At the time of the exchange it has to be held for investment or business use, not as your home, and you need to meet the §121 ownership and use test for the 5 years before the exchange. Section 121 doesn’t require the property to be your home on the exchange date.
Example 1 from the revenue procedure
A single taxpayer buys a house for $210,000 and lives in it from 2000 to 2004. From 2004 to 2006 it’s a rental, with $20,000 of depreciation. In 2006 it’s exchanged for a $460,000 townhouse to be rented out, plus $10,000 cash.
| Amount | |
|---|---|
| Amount realized ($460,000 + $10,000) | $470,000 |
| Adjusted basis ($210,000 minus $20,000) | $190,000 |
| Realized gain | $280,000 |
| Excluded under §121 | $250,000 |
| Deferred under §1031 (includes the $20,000 of depreciation gain) | $30,000 |
| Gain recognized on the $10,000 cash | $0 |
| Basis in townhouse ($190,000 + $250,000 minus $10,000) | $430,000 |
The $10,000 isn’t taxed because it’s less than the $250,000 excluded. If the cash had been larger than the excluded gain, the excess would be boot.
The revenue procedure doesn’t set a minimum rental period; the house in Example 1 is rented for about two years. For a bright line, Rev. Proc. 2008-16 gives a safe harbor for any dwelling unit: 24 months of ownership before the exchange with qualifying rental in each 12-month period. Living in the house during that window counts as personal use, so a recently converted home wouldn’t fit it. See the vacation home guide for those tests.
Section 121 amounts and conditions
| Rule | What the statute says |
|---|---|
| Basic exclusion | $250,000 (§121(b)(1)) |
| Joint return | $500,000 if either spouse meets the ownership test, both meet the use test, and neither used §121 in the prior 2 years (§121(b)(2)(A)) |
| Ownership and use | Owned and used as principal residence for periods totaling 2 years in the 5 years ending on the sale date (§121(a)) |
| Frequency | Once every 2 years (§121(b)(3)) |
| Partial exclusion | Prorated if you fall short because of a a change in place of employment, health, or unforeseen circumstances (§121(c)) (§121(c)) |
| Depreciation | Gain equal to depreciation after May 6, 1997 is not excluded (§121(d)(6)) |
Moving into a rental: two limits
Going the other direction (rental first, home later) runs into two rules.
The first is the 5-year rule. If you acquired the property in an exchange where any gain was deferred under §1031, §121 doesn’t apply to a sale within 5 years of that acquisition (§121(d)(10)). The rule follows the property to anyone whose basis is figured from yours, such as someone you give it to.
The second is nonqualified use. Under §121(b)(5), gain is allocated to “periods of nonqualified use” (time after 2008 when it wasn’t your or your spouse’s principal residence) by ratio, and that share can’t be excluded. The big exception: time after you last lived there, inside the 5-year window, doesn’t count. So home first and rental second doesn’t create nonqualified use. Rental first and home second does.
Worked example
Round numbers, for illustration. A married couple filing jointly acquires a rental in a 1031 exchange in January 2021. They rent it for 2 years and take $50,000 of depreciation, then live in it for 4 years and sell in January 2027 for $900,000. Their adjusted basis is $400,000 (carried over from the exchange, less depreciation).
| Step | Amount |
|---|---|
| Realized gain ($900,000 minus $400,000) | $500,000 |
| Depreciation gain, not excludable (§121(d)(6)) | $50,000 |
| Gain left for the ratio | $450,000 |
| Nonqualified use: 2 of 6 years owned | $150,000 |
| Eligible for exclusion | $300,000 |
| Excluded (under the $500,000 joint limit) | $300,000 |
| Taxable gain ($50,000 + $150,000) | $200,000 |
The sale clears §121(d)(10) because it’s more than 5 years after the January 2021 acquisition. Under §121(b)(5)(D), the depreciation gain comes out first and the ratio is applied to what’s left. The gain deferred in the 2021 exchange is built into the low carryover basis, so part of it lands in the excluded $300,000.
Home office, guesthouse and duplex
How much §121 covers depends on whether the business part is inside your dwelling unit. Rev. Proc. 2005-14 §2.03 points to Reg. §1.121-1(e): business space within the same dwelling unit is treated as part of the residence for the use test, while a separate unit isn’t unless it meets the 2-year use test on its own. Basis and amount realized are split the same way you split depreciation, and square footage is an acceptable method.
Examples 2 and 3 in the procedure use the same facts: a $210,000 property, one-third business use, $30,000 of depreciation, exchanged for a $240,000 residence and a $120,000 business property.
| Example 2: separate guesthouse office | Example 3: office inside the house | |
|---|---|---|
| Gain on residential two-thirds | $100,000, excluded | $100,000, excluded |
| Gain on business third | $80,000 | $80,000 |
| §121 on business third | None (separate dwelling unit) | $50,000 excluded; $30,000 depreciation gain not excludable |
| Deferred under §1031 | $80,000 | $30,000 |
| Basis in replacement business property | $40,000 | $90,000 ($40,000 + $50,000 excluded) |
A duplex where you live in one unit and rent the other generally looks like Example 2, since each unit is its own dwelling unit: §121 can cover your unit and §1031 the rental unit. Examples 5 and 6 in the procedure cover gain above the $250,000 cap.
The capital gains calculator shows what the taxable piece would cost.
Sources
Questions people ask
Can I do a 1031 exchange on my primary residence?
Not on a home used only as your residence; Rev. Proc. 2005-14 says §1031 does not apply to property used solely as a personal residence. A property that was your home and is now a rental, or a home with a separate business portion, can use both §121 and §1031.
If I move into a rental I got in a 1031 exchange, when can I use the home sale exclusion?
Not on a sale within 5 years of acquiring it in the exchange (§121(d)(10)). After that you still need 2 years of ownership and use in the last 5, and gain is prorated for rental years after 2008 under the nonqualified use rule.
Does the 121 exclusion cover depreciation I took?
No. Gain equal to depreciation after May 6, 1997 can't be excluded under §121(d)(6), but Rev. Proc. 2005-14 says §1031 can defer it.