
Short answer: The 2-out-of-5-year rule lets you avoid federal capital gains tax on up to $250,000 of profit ($500,000 if married filing jointly) when you sell your home. To qualify, you must have owned the home and lived in it as your main residence for at least 24 months during the 5 years before the sale. The 24 months don't have to be in a row.
The two tests
- Ownership test: You owned the home for at least 2 years (24 months) in the 5 years before the sale.
- Use test: You lived in it as your main home for at least 2 years in that same 5-year window.
The two periods don't have to be the same 24 months. For example, you could rent a home for 2 years, buy it, live in it 2 more years and qualify.
How long do you have to own a house in Texas to avoid capital gains?
Generally 2 years of ownership and 2 years of living in it within the last 5. Texas has no state income tax, so this federal rule is the one that matters. See our full guide to capital gains tax when selling a home in Texas.
Examples
- Qualifies: Maria bought her Pearland home in 2021, lived in it the whole time and sells in 2026 with a $160,000 gain. She owes $0 federal capital gains tax.
- Qualifies (not consecutive): James lived in his Pasadena home from 2021 to 2023, rented it out for 2 years, then sold in 2026. He lived there 2 of the last 5 years, so he can use the exclusion. Any depreciation he took while renting it out is still taxable.
- Doesn't fully qualify: A couple buys in Sugar Land and sells after 14 months. They don't meet the 2-year test, but may qualify for a partial exclusion if they moved for a qualifying reason.
Partial exclusion: selling before 2 years
If you have to sell early because of a job change (generally a new job at least 50 miles farther away), health reasons or certain unforeseen circumstances (like divorce or a death in the family), you may still get part of the exclusion. It's prorated based on how long you lived there.
Example: A married couple who lived in their home for 12 months and moves for a qualifying job change could exclude up to 12/24 of $500,000, or $250,000.
Other rules to know
- Once every 2 years: You generally can't use the exclusion if you used it on another home in the past 2 years.
- Married couples: To get the full $500,000, at least one spouse must meet the ownership test and both must meet the use test.
- Surviving spouses may still use the $500,000 limit if they sell within 2 years of a spouse's death and meet the other requirements.
- Military and certain government workers on qualified official extended duty can suspend the 5-year period for up to 10 years.
- Rental and home office use: Depreciation is taxed when you sell, even if the rest of the gain is excluded.
Planning your sale
If you're close to the 2-year mark, waiting a few extra months could save you thousands. Talk with a tax professional, then let us help you time and price your sale. Get your home's value or read is now a good time to sell in Houston?
Have more questions? We're here to help.
Every buyer and seller is different. Get answers for your situation from a local Houston agent, with no cost and no pressure.
Follow My City Homes Realty
Get Houston market updates, new listings and home buying tips every week. Follow us so you don't miss a post:
This article is general information, not tax or legal advice. Tax rules are complex and depend on your situation. Consult a CPA or tax professional before you sell.
