Skip to content

1031 Exchange

1031 Exchange and Your Primary Residence: The 2-Year and 5-Year Rules

You cannot do a 1031 exchange on a personal residence you only live in, because Section 1031 covers property held for business or investment. You can combine it with the Section 121 home sale exclusion when a home was also rented or used for business. This guide is for owners who lived in a property they now rent, or who live in part of a building they own.

  • Clear feedback on your deal, typically within 48 hours
  • 5 to 100+ units, stabilized or distressed, listed or off-market
  • Owners, agents, and brokers welcome; every conversation is confidential

We buy:Tired landlordsEstate & trust sales1031 exchangesDeferred maintenanceHigh vacancyPartnership splits

In This Guide: Why a home you live in does not qualify · Using Section 121 and 1031 together · The 2-year and 5-year rules · Second homes and the 2008-16 safe harbor · A worked example with real numbers

By Skyline Capital Investments · · 9 min read

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.

FeatureSection 121 home sale exclusionSection 1031 like-kind exchange
Property it coversYour principal residenceReal property held for business or investment
ResultGain excluded up to the capGain deferred into the replacement
Dollar limit$250,000, or $500,000 on most joint returnsNo dollar cap
Holding or use testOwned and lived in 2 of the last 5 yearsHeld for investment or business use
Depreciation after May 6, 1997Not excluded; taxed at up to 25%Can be deferred
Reinvestment requiredNo; you can keep the cashYes, through a qualified intermediary
How oftenOnce every 2 yearsNo 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.

RuleWhat it requiresSource
Ownership and useOwned and lived in the home 2 of the 5 years before saleIRC 121(a)
Once every 2 yearsNo other Section 121 exclusion in the 2 years beforeIRC 121(b)(3)
Nonqualified useRental or vacant time after 2008, before you moved in, cuts the exclusionIRC 121(b)(5)
DepreciationDepreciation after May 6, 1997 is taxable, not excludedIRC 121(d)(6)
5-year ruleHold a home acquired in a 1031 for 5 years before using Section 121IRC 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.

TestRelinquished second homeReplacement second home
OwnershipOwned at least 24 months immediately before the exchangeOwned at least 24 months immediately after the exchange
Rental each 12-month periodRented at fair rental for 14 days or moreRented at fair rental for 14 days or more
Personal use each 12-month periodNo more than 14 days, or 10% of days rented at fair rental if greaterNo 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.

Common Questions

Can you 1031 exchange your primary residence?

No. A home you only live in is personal-use property, and Section 1031 covers only real property held for business or investment. You can exchange a former residence you have since rented, the rental part of a property you also live in, or a separate business structure. Rev. Proc. 2005-14 lets you pair that exchange with the Section 121 exclusion on the residential part.

What is the 5-year rule for a 1031 exchange?

It is Section 121(d)(10). If you acquire a property in a 1031 exchange and later make it your home, you cannot use the $250,000 or $500,000 home sale exclusion on it until 5 years after the exchange. You still need 2 years of residence, and rental years after 2008 before you moved in reduce the exclusion as nonqualified use.

Can I move into my 1031 exchange property?

You can, but not right away. The replacement must be held for investment when you get it, so most owners rent it first; Rev. Proc. 2008-16 uses 24 months of fair-rent rental as its safe harbor. After you move in, the 5-year rule and the nonqualified use rule limit how much gain you can exclude when you sell.

Can you do a 1031 exchange on a second home?

Yes, if it is rented enough to be investment property. Under the Rev. Proc. 2008-16 safe harbor, you owned it 24 months before the exchange and, in each of those two years, rented it at fair rent for at least 14 days and used it yourself for no more than 14 days or 10% of rented days, whichever is greater.

How long do I have to rent my house before a 1031 exchange?

No statute sets a fixed period for a former home. Many advisors plan for two years of rental, which matches the Rev. Proc. 2008-16 safe harbor. To also use the Section 121 exclusion, sell within 3 years of moving out so you still meet the 2-of-5-year test. Keep leases and rent records to show the change in use.

Can I use Section 121 and 1031 on the same sale?

Yes. Rev. Proc. 2005-14 lets you exclude gain under Section 121 first, then defer the rest under Section 1031. Cash you take out is taxed only to the extent it exceeds the excluded gain, and your basis in the replacement is increased by the excluded amount. Depreciation after May 6, 1997 is not excluded but can be deferred.

Does the home sale exclusion cover depreciation?

No. Section 121(d)(6) says gain equal to depreciation taken after May 6, 1997 cannot be excluded. If you rented or used part of your home for business and claimed depreciation, that amount is taxed at up to 25% on an outright sale. In a combined exchange under Rev. Proc. 2005-14, the 1031 portion can defer that gain instead.

Can a 1031 exchange be used on a duplex I live in?

Yes, for the half you rent. You split the price and basis between your unit and the rental unit, usually by square footage. The rental unit can go into a 1031 exchange, and the unit you live in can qualify for the Section 121 exclusion if you meet the 2-of-5-year test. Rev. Proc. 2005-14 covers this split.

Two Ways To Work With Us

Bring Us A Deal, Or Invest In One

For Agents, Brokers & Owners

Have A Multifamily Property?

We buy apartment buildings and income-producing residential assets nationwide — listed or off-market, stabilized or value-add.

  1. 1
    Send the basicsAddress, units and asking price.
  2. 2
    We review itAgainst our buy box, confidentially.
  3. 3
    Clear answer in 48 hoursA yes, a no, or the questions we need answered.
See our buy box
Takes 60 seconds
For Investors

Looking To Invest In Multifamily?

Join our investor network to learn how we structure partnerships and to be notified when new opportunities are available to qualified investors.

  • Disciplined, conservative underwriting
  • Professionally managed, passive ownership
  • Clear reporting and direct access to the team
  • Education first — no pressure, no hype
Call Text Submit Deal Invest