BECOMING A LANDLORD

The 2-out-of-5-year rule: how renting can cost you the home-sale tax break

By the Rentium team — landlords with 100+ units of our own Updated 4 min read

Quick answer

You can exclude up to $250,000 of gain ($500,000 for most joint filers) if you owned and lived in the home as your main home for 2 of the 5 years before the sale. If you lived there 2+ years and then rent it out, you generally have about 3 years after moving out to sell. Depreciation from the rental years is taxed either way.

Free tool: Rent or sell calculator → Monthly cash flow if you rent it, cash in hand if you sell — and the date your tax-free sale window closes.

If you're thinking about renting out the home you live in now, there's one federal tax rule worth understanding before you sign a lease. It's the reason "we'll rent it for a while and see" can quietly become expensive.

The rule in one paragraph

Under section 121 of the tax code, when you sell your main home you can usually exclude up to $250,000 of gain from income — $500,000 for most married couples filing jointly. To qualify, you must have owned the home and lived in it as your main home for at least 2 of the 5 years before the date of sale. The 2 years don't have to be continuous.

Why renting starts a clock

The test looks backward from the sale date. Every month the home is a rental, the 5-year window slides forward and your 2 years of living there slide closer to falling out the back.

Worked example

Maria lived in her Austin home from June 2019 to June 2025, then rented it out when she moved for work. Her last 24 months of living there run from June 2023 to June 2025. Those months stay inside a 5-year look-back window until June 2028. Sell on or before then and she can still exclude up to $250,000 of gain. Sell in July 2028 and she can't.

That's why the practical rule of thumb is about 3 years after you move out — if you lived there at least 2 years first. The rent or sell calculator works out your exact date.

Renting afterward doesn't shrink the exclusion

There's a rule that reduces the exclusion for periods of "nonqualified use" — time when the home wasn't your main residence. But it carves out exactly the situation most accidental landlords are in: time after the last day you lived there as your main home doesn't count against you. Renting the home after you move out does not shrink the exclusion, as long as you still pass the 2-of-5-year test on the sale date. Time as a rental before you lived there can.

What's taxed no matter what: depreciation

While the home is a rental, you deduct depreciation every year (residential rentals are depreciated over 27.5 years). It lowers your taxes while you rent — and it comes back when you sell.

Depreciation you claimed (or could have claimed) after May 6, 1997 can't be excluded. That part of the gain is taxed when you sell, at a maximum federal rate of 25%.

Worked example

Suppose the building portion of your basis is $250,000. A full year's depreciation is about $9,091. Rent it for two full years and roughly $18,000 of your gain will be taxable even if the rest is excluded — at up to 25% federally, so up to about $4,500 of tax.

Skipping the depreciation deduction doesn't avoid this: the IRS taxes depreciation that was allowed or allowable. Taking it is almost always the right call.

If you lived there less than 2 years

If you have to move before you reach 2 years for a job, health, or certain unforeseen reasons, you may qualify for a partial exclusion. For a job move, the usual test is that the new job is at least 50 miles farther from the home than your old job was. The partial exclusion is a fraction of the full amount based on how long you lived there. IRS Publication 523 walks through the calculation.

A quick planning checklist

  1. Write down the date you moved out.
  2. Count your months of living there in the 5 years before that date. If it's 24 or more, add 3 years to your move-out date — that's roughly your last tax-free sale date.
  3. Put it in your calendar with a reminder six months earlier. A sale takes time.
  4. Keep every record of what you paid for the home and every improvement — they raise your basis and lower the taxable gain.
  5. Talk to a tax professional before you list, especially if your gain is close to the limit.

Sources: IRS Publication 523, Selling Your Home; IRS Publication 527, Residential Rental Property.

Common questions

Does renting out my house disqualify me from the capital gains exclusion?

Not by itself. What matters is whether you still pass the 2-of-5-year test on the day you sell. Renting the home after you move out doesn't reduce the exclusion as long as you sell in time.

Do the 2 years have to be consecutive?

No. The 24 months of living there can be spread out within the 5-year period before the sale.

Is depreciation recapture avoided if I sell within 3 years?

No. Depreciation allowed or allowable after May 6, 1997 can't be excluded and is taxed when you sell, at a maximum federal rate of 25% — even if the rest of the gain is tax-free.

General information, not legal or tax advice. Where we state a law, we link the statute and re-check it on a schedule; your city or county can add rules of its own.