Does Living in Your Rental for 2 Years Before Selling Really Erase the Tax?

Published November 18, 2026, 5:06am ET · 4 min read

This post may contain links from our sponsors and affiliates, and Flywheel Publishing may receive compensation for actions taken through them.

A young woman standing with her back to the camera carrying a cardboard box
© jacoblund / iStock

A reader who owns a rental property and has lived in it for more than two years wrote in about advice that gets repeated a lot. The claim is that if you live in a rental for two years before selling, both the capital gains tax and depreciation recapture go away. The reader read the IRS material and concluded that the exclusion only covers the time you actually lived in the home. Their example: sell after 10 years, having lived there for the last two, and you avoid only 20% of the tax. They asked us to correct them if they were wrong.

For the most part, they’re right. They read the rules more carefully than most of the articles passing along the shortcut, and a few details clarify their picture, and one of them makes the popular advice look even worse.

What the Reader Is Really Deciding

The real question is how much of the profit the home sale exclusion can reach when a property was a rental for years before it became home. Three things decide that share. They are when the rental years happened, whether you rented first or lived there first, and how much depreciation the property built up while it was rented.

Rental Years After 2008 Shrink the Exclusion

Under 26 U.S.C. § 121(b)(5)(A)[1], you can’t exclude gain allocated to periods of “nonqualified use.” In plain terms, that means time the property was something other than your main home, such as years it was rented out. Section 121(b)(5)(B)[1] allocates the gain using the ratio of nonqualified-use time to the total time you owned the property. This matches the time-based proration the reader described.

The qualified share still has to pass the basic test. Section 121(a)[1] sets the basic rule. It requires that you owned the home and used it as your principal residence for periods aggregating 2 years or more[1] during the 5-year period ending on the sale date. The reader’s stay meets that. For 2025, IRS Publication 523 caps the exclusion at $250,000, or $500,000 if married filing jointly.

One date helps landlords. Section 121(b)(5)(C)(i)[1] leaves any time before January 1, 2009 out of the definition of nonqualified use. Rental years before 2009 don’t count against the exclusion. The reader’s math holds in full only if every rental year came after 2008.

Living There First Changes Everything

The order of renting and living there 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 date the home was your principal residence doesn’t count as nonqualified use. Publication 523’s worksheet for 2025 builds this in. It tracks the days after the last day you used the property as your main home during the 5-year period prior to the date of sale.

Illustration of how the rule works: Owner A buys a house, lives in it for two years, then rents it out for three years and sells. Within the five-year window, Owner A owned and lived in the home for two years, which passes the use test, and the three rental years came after the last day it was home, so none of them count as nonqualified use. Owner A can exclude the full gain up to the cap, except for depreciation, while Owner B does the reverse: rents for three years after 2008, then lives there for two. Those three rental years are nonqualified use, and part of the gain becomes taxable. The reader is in Owner B’s position.

Depreciation Recapture Gets No Shelter at All

Depreciation recapture is the tax on the part of your profit that matches the depreciation deductions taken while the property was a rental. On this point, the popular advice is simply wrong. Section 121(d)(6)[1] says the exclusion doesn’t apply to gain up to the depreciation adjustments for periods after May 6, 1997. It doesn’t matter how long the owner later lived there.

Section 121(b)(5)(D)[1] sets the order. The depreciation portion comes out first and is taxed. The nonqualified-use ratio then applies only to the gain that’s left. In the reader’s 10-year example, the 20% applies to that remaining gain, not to the whole profit or the whole tax bill. It’s one of the quieter IRS rules that can drain a retirement sale, and we charted it alongside eight others in a free tax trap map. Rising prices raise the stakes: the Case-Shiller national home price index went from 275.934[2] in November 2021 to 336.741 in August 2026.

What We’d Want to Know Before Deciding

  • When the rental years happened. Any rental time before 2009 drops out of the nonqualified-use count, which raises the share of the gain you can exclude.
  • How much depreciation was took or allowable. That amount is taxed no matter what, so it sets the minimum taxable gain.
  • Whether the reader lived there before it became a rental. An earlier stretch as a residence counts as qualified time and brings down the nonqualified share. A rental gap between two periods of living there still counts against you.
  • Filing status. Joint filers who both meet the use test get the larger cap, which matters if the qualified gain is big.

Bottom Line for This Reader

The reader is mostly right. If you rented after 2008 and moved in later, you can exclude only the share of the non-depreciation gain that matches your time living there. Depreciation recapture is taxed in full regardless. The answer improves a lot if some rental years came before 2009, or if the owner lived there first and rented afterward, then sold within the five-year window.

Contact [email protected] for any questions or corrections.

Jake FitzGerald

Jake has been been working in financial media for almost 15 years. He focuses on all things personal finance for 24/7 Wall St. with high hopes to educate and entertain. Most recently, Jake spent 12 years working various roles at The Motley Fool. He started copy editing fool.com content, worked on premium and marketing campaigns, and helped launch The Ascent, a personal finance brand.

His work has been featured on platforms like MSN, Yahoo Finance, USA Today, and more. He's written about credit cards, social security, ETFs, savings accounts, and just about anything else you can imagine when thinking about money. Jake love to cook, play golf, and tell people he's never had a cavity. (It's true!)

All articles →

Sources

  1. 26 U.S.C. § 121 — Exclusion of gain from sale of principal residenceOffice of the Law Revision Counsel, U.S. House of Representatives
  2. S&P Cotality Case-Shiller U.S. National Home Price IndexS&P Dow Jones Indices