Citata Free AI audit

Guides · for property management companies

Selling a Former Home You Rented Out

The 2-of-5-year test, why owners talk about 3 years, and the depreciation you still pay tax on.

By · Published · Updated

How we made this guide: AI agents drafted it from our own tests and the sources listed at the end. Taras Kornichuk checked every claim and edited the text.

A pop engraving under a lilac sky: A landlord in an orange toga stands in front of a red-brick two-flat holding a rotary phone, with small tiled houses lining the sunny street behind him.
Contents
  1. Short answer
  2. What is the 2-of-5-year test (IRS Pub 523)?
  3. Why do owners talk about a 3-year window?
  4. What is nonqualified use?
  5. Does depreciation still get taxed?
  6. A checklist before you sell a former home
  7. Questions
  8. Sources

What is the 2-of-5-year test (IRS Pub 523)?

The 2-of-5-year test is the core of the home sale exclusion. You must have owned the home and lived in it as your main home for 24 months. Those months must fall in the 5 years before the sale date.

IRS Publication 523 sets out the steps:

Test Rule (Pub 523)
Ownership You owned the home for at least 24 months (2 years) of the 5 years before the sale (the closing date). For a married couple filing jointly, only one spouse must meet it.
Residence You owned the home and used it as your residence for at least 24 months of the previous 5 years.
Look-back In general, you did not exclude gain on another home sold in the 2 years before this sale.

If you pass, Pub 523 lets you exclude up to $250,000 of gain. The limit is $500,000 for a married couple filing jointly, when both meet the use test and other conditions.

The 24 months do not need to be in one block. They must fall inside the 5 years that end on the sale date.

This is general information, not tax advice. Check the current law or ask a tax professional.

Why do owners talk about a 3-year window?

Owners talk about a 3-year window because 5 years minus 2 years of living there leaves 3 years. If you lived in the home for at least 2 years, then moved out and rented it, you can rent for up to about 3 years and still pass the test.

Timeline example, with made-up dates:

Date Event
2021-06-01 Buy and move in
2024-06-01 Move out; rent the home from 2024-07-01
2027-05-31 Last day to close and still have 24 months of use in the prior 5 years (use from 2022-06-01 to 2024-06-01)
2027-08-01 Too late: only 22 months of use fall in the 5 years before this date

Watch the closing date, not the listing date. A sale that closes one month late can fail the test.

Pub 523 lists exceptions for some owners, such as members of the uniformed services, Foreign Service and intelligence community on qualified extended duty. Ask a tax professional if one applies to you.

What is nonqualified use?

Nonqualified use is time after 2008 when neither you nor your spouse used the home as your main home. Pub 523 says gain allocated to periods of nonqualified use cannot be excluded.

The key exception for a former home: Pub 523 says nonqualified use does not include any part of the 5-year period after the last date you or your spouse used the home as your main home.

So the order of events matters:

Pattern Rental time counts as nonqualified use?
Live there first, then rent, then sell No. Rental after your last day of living there, within 5 years of the sale, is excluded from nonqualified use.
Rent first, then move in, then sell Yes. Rental before you moved in, after 2008, is nonqualified use.

Pub 523’s own example: Finley buys a property on January 1, 2020, for $400,000 and rents it for 2 years, claiming $20,000 of depreciation. Finley moves in on January 1, 2022, moves out on January 1, 2024, and sells on January 1, 2025, for $700,000. The total gain is $320,000. The $20,000 of depreciation is taxed separately, and part of the remaining gain is allocated to the 2 rental years before Finley moved in.

Pub 523 also lists other exceptions, such as a temporary absence of up to 2 years in total due to a job change, health or other unforeseen circumstances.

Does depreciation still get taxed?

Yes. The exclusion does not cover gain from depreciation. Pub 523 says you cannot exclude the part of your gain equal to any depreciation allowed or allowable for periods after May 6, 1997.

“Allowed or allowable” matters. IRS Publication 946 says you must reduce basis by the depreciation allowable even if you did not claim it. So an owner who skips depreciation on the rental years still pays the tax on it at sale.

Worked example, live-then-rent, with made-up numbers:

Line Amount
Purchase price (2021) $300,000
Depreciation claimed, 2024 to 2027 −$25,000
Adjusted basis $275,000
Sale price net of selling costs (2027) $420,000
Total gain $145,000
Gain equal to depreciation (not excludable) $25,000
Remaining gain $120,000
Excluded under section 121 (single, under $250,000) $120,000
Taxable gain $25,000

The owner pays tax on $25,000 and excludes $120,000. Without the exclusion, the full $145,000 would be taxable.

A checklist before you sell a former home

  1. Write down your move-in and move-out dates. Keep proof: utility bills, a driver’s license address, tax returns.
  2. Count back 5 years from your planned closing date. Check you have 24 months of use inside it.
  3. Total your depreciation from each year’s Schedule E and Form 4562.
  4. Check the look-back test if you sold another home in the last 2 years.
  5. Decide early. If the window is closing, list 3 to 6 months ahead of the deadline.
  6. Ask about a 1031 exchange if you will not move back. Pub 523 says a property can sometimes qualify for both, under Revenue Procedure 2005-14. A tax professional must check this.

If you keep renting while you decide, our property management fee calculator shows the cost of a manager. For more owner guides, see /guides.

This is general information, not tax advice. Check the current law or ask a tax professional.

Questions

Can I rent out my home and still avoid capital gains tax?

Often, yes, within limits. If you owned and used the home as your main home for at least 2 of the 5 years before the sale, IRS Pub 523 lets you exclude up to $250,000 of gain ($500,000 for most joint filers). Depreciation from the rental years is still taxed.

What is the 3-year rule for selling a rental home?

It is not a separate rule. It comes from the 2-of-5-year test: if you lived in the home for 2 years, then rented it, you can rent for up to about 3 years and still have 2 years of use within the 5 years before the sale.

What is nonqualified use?

Nonqualified use is any period after 2008 when neither you nor your spouse used the home as your main home. Pub 523 says gain allocated to those periods cannot be excluded, but time after your last day of living there, within the 5-year window, does not count.

Do I pay tax on depreciation when I sell my former home?

Yes. Pub 523 says you cannot exclude the part of the gain equal to depreciation allowed or allowable after May 6, 1997. That is true even if you did not claim the depreciation.

Can I use the exclusion more than once?

Pub 523 has a look-back test: in general, you cannot use the exclusion if you excluded gain on another home sold in the 2 years before this sale.

Sources

  1. IRS: Publication 523, Selling Your Home
  2. IRS: Publication 946, How To Depreciate Property
  3. IRS: Publication 527, Residential Rental Property

Does AI name your company? Find out for free.

Free audit: 20 landlord questions, 4 AI engines, your top 5 fixes.

Get the free audit
A pop engraving under a lilac sky: a man in an orange toga with a big key knocks on a mint-green door, a sealed letter in his hand and a cat on the step.