This article may include links from our sponsors and affiliates, and Flywheel Publishing may receive compensation for actions taken through them.
A reader who owns a rental property and has lived in it for more than two years asked about a claim that gets repeated often: live in a rental for two years before selling, and both capital gains tax and depreciation recapture disappear. After reading IRS guidance, the reader believed the exclusion applies only to the time actually spent living in the home. In their example, selling after 10 years with the last two as a residence would eliminate only 20% of the tax. They asked for a correction if that understanding was wrong.
In broad terms, the reader is right. They have read the rules more carefully than many of the articles repeating the shortcut, and a few details sharpen the picture. One of those details makes the popular advice look even less favorable.
What the Reader Is Really Asking
The real issue is how much of the home-sale gain can be covered by the exclusion when a property spent years as a rental before becoming a primary residence. Three factors determine that share: when the rental years occurred, whether the owner rented first or lived there first, and how much depreciation was claimed while the property was rented.
Rental Years After 2008 Reduce the Exclusion
Under 26 U.S.C. § 121(b)(5)(A)[1], gain tied to periods of “nonqualified use” cannot be excluded. In everyday language, that means time when the property was not the owner’s main home, such as years it was rented out. Section 121(b)(5)(B)[1] allocates the gain based on the ratio of nonqualified-use time to total ownership time. That matches the time-based proration the reader described.
The qualified portion still has to satisfy the main rule. Section 121(a)[1] requires the owner to have held and used the home as a principal residence for at least 2 years during the 5-year period ending on the sale date. The reader’s stay meets that test. For 2025, IRS Publication 523 sets the exclusion at $250,000, or $500,000 for married couples filing jointly.
One cutoff date helps landlords. Section 121(b)(5)(C)(i)[1] excludes any time before January 1, 2009 from the definition of nonqualified use. Rental years before 2009 do not count against the exclusion. So the reader’s calculation works fully only if all rental years came after 2008.
Living There First Changes the Result
The order of renting and living in the home matters a great deal. Under Section 121(b)(5)(C)(ii)(I)[1], any part of the five-year window that comes after the last day the home was used as the principal residence does not count as nonqualified use. Publication 523’s 2025 worksheet reflects this by counting the days after the last day the property was used as the main home during the five years before sale.
Example of how the rule works: Owner A buys a house, lives in it for two years, then rents it for three years and sells. Within the five-year window, Owner A owned and lived in the home for two years, satisfying the use test, and the three rental years came after the last day it was a home, so they are not treated as nonqualified use. Owner A can exclude the full gain up to the cap, except for depreciation. Owner B does the reverse: rents for three years after 2008, then lives there for two years. Those three rental years count as nonqualified use, and part of the gain becomes taxable. The reader is in Owner B’s position.
Depreciation Recapture Is Not Protected
Depreciation recapture taxes the part of the profit that corresponds to depreciation deductions taken while the property was a rental. On this point, the common shortcut is wrong. Section 121(d)(6)[1] says the exclusion does not apply to gain equal to depreciation adjustments for periods after May 6, 1997. It does not matter how long the owner later lived in the home.
Section 121(b)(5)(D)[1] establishes the sequence. The depreciation portion comes out first and is taxed. Only after that does the nonqualified-use ratio apply to the remaining gain. In the reader’s 10-year example, the 20% applies only to the leftover gain, not to the entire profit or the whole tax bill. It is one of the quieter IRS rules that can shrink a retirement sale, and we mapped it with eight others in a free tax trap guide. Rising home prices make the issue more important: the Case-Shiller national home price index rose from 275.934[2] in November 2021 to 336.741 in August 2026.
What Matters Before Making the Decision
- When the rental years occurred. Any rental time before 2009 falls outside the nonqualified-use calculation, increasing the amount of gain that can be excluded.
- How much depreciation was taken or allowed. That amount is taxable no matter what, so it sets the minimum taxable gain.
- Whether the owner lived there before it became a rental. An earlier period as a residence counts as qualified use and reduces the nonqualified share. A rental gap between two periods of living there still counts against the owner.
- Filing status. Joint filers who both meet the use test qualify for the larger cap, which matters if the eligible gain is substantial.
Bottom Line for This Reader
The reader is mostly correct. If the property was rented after 2008 and the owner moved in later, only the portion of the non-depreciation gain that matches the time lived there can be excluded. Depreciation recapture is taxed in full regardless. The result improves significantly if some rental years came before 2009, or if the owner lived there first, rented it later, and sold within the five-year window.
More from Digilifetrends
Reverse Mortgages Make Sense Only for Lifelong Homeowners — Start by Comparing Cheaper Alternatives
Once you turn 62, a reverse mortgage can convert home equity into cash without monthly payments, but the upfront charges can reach thousands of dollars and the loan balance keeps…
2 min read · Published 2026-11-29Buying a Home With a Friend? Put a Co-Ownership Deal in Place Before Closing
Buying a house with a friend can be a workable arrangement, but the lender still considers each borrower responsible for the full mortgage. That is why it is important to have a…
3 min read · Published 2026-11-29Buying a Condo: HOA Records Can Reveal an Upcoming Special Assessment
A condo’s purchase price covers your unit, but the association’s finances determine what you may owe after you move in. Before your deposit becomes nonrefundable, review the HOA…
2 min read · Published 2026-11-29