Can you do a 1031 exchange on your primary residence?
No, not on a home you use only as your residence. A 1031 exchange on a personal residence fails because Section 1031(a) applies only to real property held for productive use in a trade or business or for investment, and a home you live in is held for personal use.
The answer changes when the property has two roles. If you rented the house after moving out, rent part of it, run a business from a separate structure on the lot, or live in one unit of a building you lease to others, the investment part can qualify for a 1031 exchange. The part you lived in can qualify for the Section 121 exclusion. The IRS explained how to use both on one sale in Revenue Procedure 2005-14.
So the real question for most owners is timing: how long the property was a home, how long it was a rental, and when you sell. The rest of this page walks through those rules with the actual statute numbers.
Section 121 vs. Section 1031: how the two rules differ
Section 121 excludes gain on a main home, and Section 1031 defers gain on investment property. Excluded gain is never taxed. Deferred gain carries into the replacement property through a lower basis and is taxed later unless you exchange again or hold until death.
| Feature | Section 121 home sale exclusion | Section 1031 like-kind exchange |
|---|---|---|
| Property it covers | Your principal residence | Real property held for business or investment |
| Result | Gain excluded up to the cap | Gain deferred into the replacement |
| Dollar limit | $250,000, or $500,000 on most joint returns | No dollar cap |
| Holding or use test | Owned and lived in 2 of the last 5 years | Held for investment or business use |
| Depreciation after May 6, 1997 | Not excluded; taxed at up to 25% | Can be deferred |
| Reinvestment required | No; you can keep the cash | Yes, through a qualified intermediary |
| How often | Once every 2 years | No limit |
The 2-year rule for the home sale exclusion
To exclude gain under Section 121, you must have owned the home and used it as your principal residence for at least 2 years during the 5 years ending on the sale date. The 2 years do not need to be continuous, and the ownership years and the use years do not have to be the same years.
The cap is $250,000 of gain for a single filer and $500,000 for a married couple filing jointly when both spouses meet the use test, at least one meets the ownership test and neither used the exclusion in the prior 2 years (IRS Topic 701 and Publication 523). Section 121(b)(3) bars a second exclusion within 2 years of the first.
The 5-year lookback is what makes a later 1031 possible. If you move out and rent the house, you still pass the 2-of-5 test for up to 3 years after you leave. Sell inside that window and both rules can apply to the same sale.
How to use Section 121 and 1031 together (Rev. Proc. 2005-14)
Revenue Procedure 2005-14 lets you exclude gain under Section 121 first and then defer the remaining gain under Section 1031 on the same sale. It took effect January 27, 2005 and sets four rules that do most of the work.
- Apply Section 121 first. The exclusion comes off the realized gain before Section 1031 is applied.
- Depreciation stays out of Section 121. Gain equal to depreciation taken after May 6, 1997 cannot be excluded, but it can be deferred by the 1031 exchange.
- Cash first offsets the exclusion. Boot you receive, such as cash taken out at closing, is taxed only to the extent it is more than the gain you excluded.
- Basis goes up by the exclusion. Your basis in the replacement property equals the old adjusted basis, plus the excluded gain, minus cash received, plus any gain recognized.
The 1031 exchange 5-year rule: moving into a replacement property
The 1031 exchange 5-year rule says you cannot claim the Section 121 exclusion on a home you acquired in a 1031 exchange unless you sell it at least 5 years after you acquired it. It is Section 121(d)(10), added by the American Jobs Creation Act of 2004, and it applies even if you lived there for the full 2 years.
Owners run into it when they exchange into a rental, rent it for a while and then move in. The move itself is not the problem. Selling before the fifth anniversary of the exchange is. The rule also follows the property to anyone whose basis is figured from yours, such as a person who received the house as a gift.
A second limit applies on top of the 5-year rule. Section 121(b)(5) treats periods after December 31, 2008 when the home was not your principal residence as nonqualified use, and the share of gain tied to those periods cannot be excluded. Time after you last lived there, within the 5-year window, does not count against you. Time renting before you moved in does.
The IRS also looks at intent. An exchange into a house you plan to live in right away is not an exchange of investment property. Rev. Proc. 2008-16, covered below, gives a safe harbor for how long to rent the replacement before any personal use.
| Rule | What it requires | Source |
|---|---|---|
| Ownership and use | Owned and lived in the home 2 of the 5 years before sale | IRC 121(a) |
| Once every 2 years | No other Section 121 exclusion in the 2 years before | IRC 121(b)(3) |
| Nonqualified use | Rental or vacant time after 2008, before you moved in, cuts the exclusion | IRC 121(b)(5) |
| Depreciation | Depreciation after May 6, 1997 is taxable, not excluded | IRC 121(d)(6) |
| 5-year rule | Hold a home acquired in a 1031 for 5 years before using Section 121 | IRC 121(d)(10) |
How to convert a primary residence to a rental before a 1031
To convert a primary residence for a 1031 exchange, you move out and rent it at fair market rent long enough that it is clearly held for investment when you sell. The Code sets no minimum rental period for a relinquished property, but two years of rental is the common planning target because it matches the Rev. Proc. 2008-16 safe harbor and leaves a year of room inside the 3-year Section 121 window.
Keep records that show investment intent: a signed lease, rent deposits, a Schedule E on your return, depreciation taken and the property listed for rent rather than left empty. Depreciation you take as a landlord lowers your basis, and that gain cannot be excluded later, but the exchange can defer it.
Timing matters in both directions. Sell too soon after moving out and the IRS may say the house was still your home. Wait more than 3 years and you lose the Section 121 exclusion, so the whole gain depends on the exchange.
Worked example: a house that became a rental
A married couple bought a house for $400,000 in 2016 and lived there until July 2024. They rented it from then on and took $25,000 of depreciation, so their adjusted basis is $375,000. In 2026 they sell for $1,000,000, still inside the 3-year window after moving out. To keep the math simple, the example ignores selling costs.
Their gain is $625,000. Of that, $25,000 is depreciation, which Section 121 cannot exclude. The other $600,000 is eligible, but the joint cap is $500,000, so $500,000 is excluded and $125,000 remains.
Sold outright, the $125,000 would be taxed. The $25,000 of depreciation is taxed at up to 25% ($6,250). The other $100,000 is taxed at 15% or 20%; in 2026 the 20% rate starts above $613,700 of taxable income for joint filers (Rev. Proc. 2025-32). At the top rates, plus the 3.8% net investment income tax on $125,000, the federal bill is about $31,000. At the 15% rate without the surtax, it is $21,250.
With a 1031 exchange under Rev. Proc. 2005-14, they buy a $500,000 rental through a qualified intermediary and take $500,000 in cash. The cash is boot, but it is taxed only to the extent it exceeds the $500,000 excluded, so none of it is taxed. The $125,000 is deferred.
Their basis in the new rental is $375,000: the old $375,000 basis, plus $500,000 excluded, minus $500,000 of cash. The new property is worth $500,000, so the $125,000 of deferred gain is built into it.
Now say they move into that rental after 3 years, having taken another $30,000 of depreciation, live there 2 years and sell in year 5 for $650,000. The 5-year rule is met. The gain is $305,000. The $30,000 of depreciation is taxable. Counting ownership from the exchange date, three-fifths of the remaining $275,000 ($165,000) is tied to nonqualified rental years and is taxable too, so only $110,000 is excluded. How the ownership period and the $25,000 of depreciation carried over from the first house are treated can change these figures, so have a CPA run them.
Can you do a 1031 exchange on a second home or vacation home?
Yes, if the second home is rented enough to count as investment property. A 1031 exchange for a second home you use only yourself does not qualify. Rev. Proc. 2008-16 sets a safe harbor for dwelling units exchanged on or after March 10, 2008, and if you meet it the IRS will not challenge whether the home qualified.
The safe harbor covers a house, apartment, condominium or similar unit with sleeping space, a bathroom and cooking facilities. It applies to both the home you give up and the one you get.
| Test | Relinquished second home | Replacement second home |
|---|---|---|
| Ownership | Owned at least 24 months immediately before the exchange | Owned at least 24 months immediately after the exchange |
| Rental each 12-month period | Rented at fair rental for 14 days or more | Rented at fair rental for 14 days or more |
| Personal use each 12-month period | No more than 14 days, or 10% of days rented at fair rental if greater | No more than 14 days, or 10% of days rented at fair rental if greater |
Living in one unit of a building you rent out
If you live in one unit of a duplex, fourplex or larger apartment building, the units you rent are investment property and your unit is your residence. Rev. Proc. 2005-14 lets you exclude gain on your unit under Section 121 and exchange the rental units under Section 1031 in the same sale.
You split the sale price and the basis between the two parts using the method you used for depreciation. Square footage is acceptable. In a 6-unit building with equal units, about one-sixth of the gain goes to your home and five-sixths goes to the exchange.
The same split applies to a home office inside the house. Under the Section 121 regulations, an office inside the dwelling unit does not need a separate allocation for the exclusion, though depreciation on it is still taxable. A separate structure, such as a rented guesthouse or a detached office, is allocated separately.
What happens to the deferred gain later
The gain you defer stays with the replacement property until a taxable sale. Each later exchange can push it further out, and if you still own the property at death, your heirs generally receive a basis equal to fair market value on the date of death under Section 1014, which erases the deferred gain for income tax purposes.
The excluded part is different. Gain excluded under Section 121 is gone for good and is added to your basis in the replacement, as the example above shows. That is why owners who qualify for both rules usually want the exclusion to absorb as much of the gain as the cap allows, with the exchange covering the depreciation and the rest.
How the sale is reported
You report the exchange on Form 8824 and the excluded and taxable gain using the Publication 523 worksheets, with any taxable part on Form 8949, Schedule D or Form 4797. The Form 8824 instructions have you write "Section 121 exclusion" and the amount next to line 19 without reducing that line, subtract the exclusion from your boot on line 20, and add it to the basis figure on line 25. If the property was partly a home and partly a rental, they tell you to prepare two worksheet Forms 8824, one for each part.
Mistakes that cost owners the exclusion or the exchange
Most failed plans come from one of a handful of timing and paperwork errors.
- Waiting more than 3 years after moving out to sell, which drops the Section 121 exclusion.
- Taking the sale proceeds yourself instead of routing them through a qualified intermediary, which ends the exchange.
- Moving into a replacement property right after the exchange, which undercuts investment intent.
- Selling a home acquired in a 1031 before the fifth anniversary and expecting the exclusion.
- Assuming depreciation is covered by the exclusion. It is not, and it is taxed at up to 25%.
- Renting to family below market rent, which does not count as fair rental under Rev. Proc. 2008-16.
Selling a building you live in to Skyline
If you live in one unit of an apartment building with five or more units, the split described above is likely your situation. Skyline buys these buildings nationwide. We buy directly, close on your timeline, and can work inside 1031 deadlines. Tell us the date you moved out, or the unit you live in, and when your Section 121 window closes, and we will tell you whether our timing fits before you commit. You can model the deferred tax first with our 1031 exchange calculator and the outright sale with the capital gains tax calculator.