
Selling a Former Home You Rented Out: The Section 121 Rules
If you owned and lived in a home as your principal residence for at least 2 of the 5 years before the sale, IRC § 121 can exclude up to $250,000 of gain ($500,000 for joint filers who meet the conditions), even if you rented it out in between. Two parts of the gain stay taxable: the depreciation you took (or could have taken) after May 6, 1997, and, if you rented before you moved in, the gain allocated to that "nonqualified use." California follows the same exclusion.
The short version
- The ownership and use test: periods totaling 2 years (24 months) or more within the 5 years ending on the sale date. The months need not be consecutive.
- Renting after you move out is not nonqualified use, as long as you still meet the 2-of-5 test on the sale date (the depreciation stays taxable).
- Renting before you move in can be nonqualified use, which makes part of the gain taxable.
- Depreciation allowed or allowable after May 6, 1997 is never excluded (§ 121(d)(6)).
- If you or your spouse are on qualified official extended duty, you can elect to suspend the 5-year period, for no more than 10 years (§ 121(d)(9)).
- A home acquired in a § 1031 exchange can't use the exclusion for 5 years after the acquisition (§ 121(d)(10)).
The 2-of-5-year test after renting
Under § 121(a), gain is excluded if you owned the home and used it as your principal residence for periods totaling 2 years or more during the 5 years ending on the date of sale. The limits are $250,000, or $500,000 for joint filers who meet the conditions (§ 121(b)(1) to (2)).
The test looks back from the sale date. Once you move out and rent the home, each month of renting is a month of the 5-year window that is not a use month. The date that matters is the last day on which 2 years of use still fall inside the 5 years before the sale. The home sale exclusion timeline lays out those dates from your move-in and move-out dates.
Nonqualified use: when rental time costs you
Pub 523 defines it: "Nonqualified use means any period after 2008 when neither you nor your spouse (or former spouse) used the property as your main home, with certain exceptions." Gain allocated to nonqualified use is not excluded (§ 121(b)(5)).
Three kinds of periods are not nonqualified use:
| Period | Counts as nonqualified use? | Rule |
|---|---|---|
| Time after the last date the home was your principal residence (for example, you move out and rent before selling) | No | § 121(b)(5)(C)(ii) |
| Up to 10 years in total when you or your spouse are on qualified official extended duty | No | § 121(b)(5) |
| Temporary absences, up to 2 years in total, due to a change of employment, health or unforeseen circumstances | No | § 121(b)(5) |
| Renting the home after 2008 before you first moved in | Yes, generally | Pub 523 |
Depreciation is handled first. Pub 523: "Gain from depreciation for periods after May 6, 1997, isn't taken into account to determine gain from nonqualified use."
Two IRS examples
Pub 523 (2025) includes worked examples. These are the IRS's own figures, not a calculation for any reader:
- Rental before moving in. In one example, an owner bought a home on January 1, 2020, rented it for 2 years and claimed $20,000 of depreciation, lived in it during 2022 and 2023, moved out January 1, 2024, and sold it January 1, 2025. Of the $300,000 gain left after setting aside the depreciation, 40% (2 of 5 years) was allocated to nonqualified use and could not be excluded, and the $20,000 of depreciation could not be excluded either.
- Rental after moving out. In another, an owner lived in the home from 2020 to 2022, rented it from January 1, 2023, and sold it December 1, 2024. The rental period after the last qualified use was not nonqualified use, so the owner could exclude up to $250,000, but not the $27,000 of depreciation.
Depreciation stays taxable
Section 121(d)(6) and Pub 523 say you "can't exclude the part of your gain equal to any depreciation allowed or allowable" for periods after May 6, 1997. "Allowable" matters: if you rented the home and did not claim depreciation, the amount you could have claimed still counts. The depreciation part is generally unrecaptured § 1250 gain, taxed federally at up to 25%; see selling a rental property. When you convert a home to a rental, the depreciation basis is the lesser of fair market value or adjusted basis on the date of conversion; see rental property depreciation.
One related point: gain you exclude under § 121 is not subject to the 3.8% net investment income tax.
Military owners: the suspension
Under § 121(d)(9), you can elect to suspend the 5-year period while you or your spouse are on "qualified official extended duty":
- a duty station at least 50 miles from the home, or living in government quarters under government orders;
- under orders for more than 90 days or for an indefinite period;
- and the suspension can't extend the 5-year period by more than 10 years.
Those duty periods, up to 10 years in total, are also not nonqualified use. California conforms to the suspension (FTB Pub 1032). For the full rules, see the military home sale exclusion and California taxes for military homeowners.
Section 121 and 1031 exchanges
- If a former home is now a rental and qualifies for both § 121 and § 1031, Rev. Proc. 2005-14 applies § 121 first, then § 1031 to the rest of the gain, including the depreciation gain. See 1031 exchange basics.
- Going the other way, Pub 523 says "You can't convert the replacement property to a main home immediately after the exchange," and § 121 does not apply to a sale during the 5 years after you acquired the home in a § 1031 exchange.
California differences
California conforms to § 121, with the same $250,000 and $500,000 limits and the 2-of-5-year test, and adds a Peace Corps rule of up to 18 months (FTB Pub 1001). California has no separate rate for the depreciation part, which it taxes as ordinary income.
Escrow withholding is the trap. Form 593 exempts a home that was your principal residence under § 121, and a home last used as your principal residence "without regard to the two-year time period." But if the last use was "a vacation home, second home, or rental, you do not qualify" for the last-used exemption. Other exemptions, such as a loss or zero gain for California purposes, may still apply. See California withholding when you sell a rental.
What to do next
- Write down your purchase date, move-in date, move-out date and each rental period.
- Use the home sale exclusion timeline to see the date by which a sale still meets the 2-of-5 test.
- Gather every year's depreciation schedule; you will need the total allowed or allowable.
- If you are military, collect the orders that show your duty station and duty dates.
- Ask your tax professional to confirm the exclusion and any nonqualified use before you list, and ask your escrow officer about Form 593.
- Coronado owners weighing the choice can also read rent or sell your Coronado home.
McKee Properties manages rentals from its Coronado office; contact us with questions about your property.
Frequently asked questions
Can I rent out my home and still get the home sale exclusion?
Yes, if you still meet the test on the sale date: you owned and used the home as your principal residence for periods totaling at least 2 years in the 5 years before the sale. Renting after you move out does not count as nonqualified use, but the depreciation from the rental period stays taxable.
Does renting before I moved in reduce the exclusion?
It can. Periods after 2008 when neither you nor your spouse used the home as your main home are generally nonqualified use, and gain allocated to them is not excluded. Pub 523 shows an IRS example in which 2 years of renting before move-in, out of 5 years of ownership, made 40% of the remaining gain taxable.
Is depreciation from the rental years excluded?
No. Section 121(d)(6) does not let you exclude gain equal to depreciation allowed or allowable for periods after May 6, 1997. That includes depreciation you were entitled to but did not claim.
How does the military suspension work?
You can elect to suspend the 5-year period while you or your spouse serve on qualified official extended duty, meaning a duty station at least 50 miles from the home or living in government quarters, under orders for more than 90 days or indefinitely. The suspension can't extend the 5-year period by more than 10 years, and California conforms.
Will escrow withhold California tax when I sell my former home?
Possibly. Form 593 exempts a principal residence under § 121 and a home last used as your principal residence, but not one whose last use was as a rental. If that exemption does not apply, another, such as a California loss or zero gain, might; otherwise escrow generally withholds 3 1/3% of the sales price or an elected alternative amount.
This is general information, not tax or legal advice. Tax rules change and depend on your facts; talk to a CPA or enrolled agent before acting.
Sources
- IRC § 121 (opens in a new tab)
- IRS Publication 523 (2025) (opens in a new tab)
- IRS Publication 527 (2025) (opens in a new tab)
- Rev. Proc. 2005-14 (opens in a new tab)
- IRS, Net Investment Income Tax (opens in a new tab)
- FTB Publication 1001 (2025) (opens in a new tab)
- FTB Publication 1032 (2025) (opens in a new tab)
- 2025 Form 593 instructions (opens in a new tab)
Verified October 19, 2026.
Talk With a Local Property Expert
Ask your questions, get honest answers, and see if we’re the right fit — no commitment.
Schedule a Call
