What Is the 2-Out-of-5-Year Rule for Rental Property?

The 2-out-of-5-year rule for rental property lets you exclude up to $250,000 of gain ($500,000 for married couples filing jointly) when you sell, as long as you owned the home and lived in it as your primary residence for at least two of the five years ending on the closing date.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The complication with a property that has also been a rental is that two other rules run alongside the exclusion: depreciation you took (or could have taken) is taxed separately, and if the rental period came before you moved in, part of your gain is permanently locked out of the exclusion. Whether you keep most of your profit tax-free comes down to the order of those uses and when you close.

The Two Tests Inside the Rule

There are actually two tests, and both are measured over the five-year window that ends on your sale date. You must have owned the property for at least two of those years, and you must have used it as your primary residence for at least two of those years.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence The two years total 730 days and don’t have to be consecutive. Fourteen months in the house, a year of rental, then ten months back in the house adds up to two qualifying years.

The clock runs from the exact date title transfers to the buyer, so count backward five years from closing.

The $500,000 Joint Exclusion

Married couples filing jointly can exclude up to $500,000, but the rules split slightly. Only one spouse needs to satisfy the ownership test. Both spouses have to independently meet the two-year use test. And neither spouse can have claimed a Section 121 exclusion on a different sale in the two years before this one.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence If only one spouse meets the use test, the couple can still claim up to $250,000 based on that spouse’s eligibility.

If You Moved Out and Rented the Home

This is the common path. You lived in your home, then converted it to a rental, and now you’re selling. Because the five-year lookback runs backward from the closing date, you have a three-year window after moving out to sell and still qualify with two full years of qualifying use inside the window.

Sell later than that, and your two years of residency slide outside the five-year frame. The entire gain becomes taxable because you no longer meet the use test.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Owners often hold on for “one more year” of rent and unknowingly cross that line. If you’re weighing this strategy, mark the three-year anniversary of your move-out date.

The good news for this direction: rental time that falls after you move out is not treated as “non-qualified use” for the allocation formula described below.2Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence – Section 121(b)(5)(C)(ii) So as long as you close inside the three-year window, the full exclusion is available. You will still owe depreciation recapture on the deductions you took during the rental years.

If You Rented the Property First, Then Moved In

The picture changes when the rental use came before you moved in. Under rules from the Housing Assistance Tax Act of 2008, applicable to sales after December 31, 2008, that pre-residency rental period is “non-qualified use,” and a portion of your gain is permanently ineligible for the exclusion no matter how long you live there afterward.

The math is a ratio. Divide the total days of non-qualified use by the total days you owned the property, then multiply by the gain. That share is taxable and can’t be excluded. Owned a property for ten years, rented it for the first four, then lived in it for six? Forty percent of the gain sits outside the exclusion, and the $250,000 or $500,000 cap applies only to the other 60%.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence

What Doesn’t Count as Non-Qualified Use

The statute names three exceptions:2Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence – Section 121(b)(5)(C)(ii)

  • Time after the last day you used the property as your primary residence. This is why the “moved out, then rented” path avoids the allocation problem entirely.
  • Up to ten years of qualified official extended duty for the uniformed services, Foreign Service, or intelligence community.3Internal Revenue Service. Publication 523, Selling Your Home
  • Up to two years of absence due to a job change, health condition, or other unforeseen circumstances.

Depreciation Recapture Is Separate

Even when your gain qualifies for exclusion, depreciation you claimed or were allowed to claim during the rental years is carved out and taxed on its own. Depreciation taken after May 6, 1997, cannot be sheltered by the $250,000 or $500,000 exclusion.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5 That amount is taxed as unrecaptured Section 1250 gain at a maximum rate of 25%.

A detail that surprises many sellers: the IRS treats the depreciation as taken whether you deducted it or not. If you were eligible during the rental years and skipped it on your Schedule E, the recapture is still calculated as though you had claimed it. Skipping the deduction saves you nothing at sale, so claim what you’re entitled to during the rental period.

To compute recapture, add every year’s depreciation deduction (or allowable deduction) and subtract that total from your basis. The result is taxed at up to 25%, separate from the long-term capital gains rate that applies to any remaining taxable gain.4Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 5

Partial Exclusion When You Have to Sell Early

Falling short of the two-year use test doesn’t automatically mean the whole gain is taxable. A reduced exclusion is available when the sale is caused by a qualifying event: a work-related move, a health-related move, or an unforeseen circumstance.5Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence – Section 121(c)

The formula: take the shorter of the time you actually lived in the home during the five-year window, the time you owned it, or the time since you last claimed a Section 121 exclusion. Divide that by 730 days (or 24 months), then multiply by $250,000 (or $500,000 for joint filers).3Internal Revenue Service. Publication 523, Selling Your Home Fifteen months of residency before a qualifying job transfer forced the sale? 15/24 × $250,000 = $156,250.

The IRS treats several situations as automatic qualifying events, including a workplace change where the new job is at least 50 miles farther from the home than the old one,6Internal Revenue Service. Topic No. 701, Sale of Your Home a move to obtain or provide medical care, the death of an owner or co-owner, divorce or legal separation, destruction or condemnation of the home, an involuntary loss of income that leaves you unable to cover housing and basic living costs, and multiple births from the same pregnancy.3Internal Revenue Service. Publication 523, Selling Your Home If your situation doesn’t match one of the listed events, the IRS applies a facts-and-circumstances test: was the primary reason for the sale something you couldn’t reasonably have anticipated when you bought or moved into the home?

The Military and Foreign Service Suspension

Members of the uniformed services, Foreign Service, and intelligence community can suspend the five-year lookback for up to ten years while on qualified official extended duty.3Internal Revenue Service. Publication 523, Selling Your Home Qualified extended duty means a station at least 50 miles from the home, or residing in government housing under orders, for more than 90 days or an indefinite period.6Internal Revenue Service. Topic No. 701, Sale of Your Home

With the suspension, the five-year test period effectively stretches out to as long as fifteen years. A service member who lived in a home for two years, deployed for eight while the property was rented, then sold, can still claim the full exclusion because the deployment years are suspended rather than counted. The suspension applies to only one property at a time.

You Can Only Use the Exclusion Once Every Two Years

If you claimed a Section 121 exclusion on a different home sale in the two years before this one, the full exclusion isn’t available.1Office of the Law Revision Counsel. 26 USC 121 – Exclusion of Gain From Sale of Principal Residence Meeting the ownership and use tests doesn’t cure this. For a couple filing jointly, neither spouse can have used the exclusion in the prior two years to claim the $500,000. If one spouse claimed it 18 months ago, the couple can’t take the joint amount, though the other spouse may still claim up to $250,000 individually depending on the facts.

Figuring the Gain: Adjusted Basis

Your gain depends on your adjusted basis. Start with what you paid for the property, including certain settlement costs at purchase: title insurance, deed recording fees, transfer taxes, and survey costs.7Internal Revenue Service. Property (Basis, Sale of Home, Etc.) 3 Loan-origination and other financing costs generally do not increase basis.

Add the cost of capital improvements over the years: a new roof, an addition, a kitchen remodel, replaced plumbing. Repairs and routine maintenance don’t count. Keep receipts; estimates won’t hold up.

Subtract total depreciation, including deductions you were entitled to but didn’t claim. What remains is your adjusted basis. Net sale proceeds (sale price minus selling expenses like agent commissions) minus adjusted basis equals your total gain.

Reporting the Sale

A sale with both excluded and taxable gain usually flows through three forms, plus a Form 1099-S from the closing agent reporting the gross proceeds. If you received a 1099-S, you generally have to report the sale even when the entire gain is excluded.8Internal Revenue Service. Instructions for Form 1099-S

  • Form 8949 lists the sale details (dates acquired and sold, proceeds, basis) and feeds the gain or loss into Schedule D.9Internal Revenue Service. Instructions for Form 8949
  • Schedule D aggregates capital gains and losses. The Unrecaptured Section 1250 Gain Worksheet in the Schedule D instructions is where you calculate the depreciation portion taxed at up to 25%.10Internal Revenue Service. Instructions for Schedule D (Form 1040)
  • Form 4797 is used to compute the sale gain and separate the depreciation-related portion; its instructions specifically note that you can’t exclude gain to the extent of depreciation taken after May 6, 1997.11Internal Revenue Service. Instructions for Form 4797 (2025)

Hold on to settlement statements, improvement receipts, depreciation schedules, and any records of move-in and move-out dates for at least three years after filing.12Internal Revenue Service. How Long Should I Keep Records Seven years is safer for a return this complex. The IRS has six years to audit if it suspects income was underreported by more than 25%, and a rental-to-residence conversion with depreciation recapture is exactly the kind of filing that draws a closer look.