How Long Do You Need to Own Your Home to Escape Capital Gains Taxes on the Sale of It?

If you owned and lived in your home for at least two of the five years before selling it, you might qualify to exclude up to $250,000 of gain from the sale from income tax, or up to $500,000 if you are married and filing jointly. If you don't meet these eligibility requirements, you might still be able to exclude a portion of the gain if you sold your home because of an unforeseen event, such as a work relocation or a health emergency.

Maximum Income Tax Exclusion

To qualify for the maximum income tax exclusion, all of the following must be true:

  1. You did not acquire your home through a like-kind exchange during the past five years.
  2. You are not a resident or nonresident alien subject to expatriate tax.
  3. You owned and lived in your home at least two of the five years before the date you sold it.
  4. You lived in the home as your primary residence for at least 730 days during the five years before the sale (the residency days do not have to be consecutive).
  5. You did not exclude the gain from the sale of another home during the two years before the sale of this home.


If you have a disability and you are unable to care for yourself, you only have to show that you used the home for one out of the five years before the sale. Any time you spent in a state-licensed care facility qualifies as time you lived in your home. There are also special rules if you work for the government in foreign service or intelligence or if you're in the Peace Corps. A different set of criteria usually apply if your home was condemned or destroyed.

Partial Exclusion

If you don't meet these criteria, you might qualify for a partial exclusion if you had to sell your home because of an unforeseen event related to your employment, your health or your ability to pay for your home. Circumstances that usually qualify if they affect you, your spouse, a co-owner or another family member who lives in the home as a primary residence include:

  • Taking or transferring to a job more than 50 miles away.
  • Moving to obtain care for a disease, illness or injury.
  • Moving to provide care to an ill family member.
  • Death, divorce or legal separation.
  • Having two or more children from the same pregnancy.
  • Becoming eligible for unemployment compensation.
  • Becoming unable to pay basic living expenses because of a change in employment.

Calculating Gain

The IRS provides a worksheet to help you compute the gain from the sale of your home. First, take the sales price and subtract closing fees such as real estate commissions and legal fees. Then subtract the amount you paid to buy the house and the cost of any additions or improvements you made to the house (repairs don't qualify). Then add adjustments for deductions you took in prior years. For example, suppose you bought your home for $150,000 and added a garage that cost $20,000. You sold the house for $230,000 and paid 6 percent sales commission and $3,000 in legal fees. Your gain is $230,000 minus $20,000 minus $150,000 minus $13,800 minus $3,000, or $43,200.


If you took deductions in prior years for using your home as a business, you must exclude the percentage that you attributed to business. You must also add any insurance payments you received to cover losses, sales tax you deducted, energy credits or subsidies, first-time homebuyer credits, adoption credits or other deductions you claimed for your home.

Determining Excludable Gain

If you qualify for the maximum exclusion, you can exclude up to $250,000 of the gain from your income taxes, or up to $500,000 if you are married and filing jointly. If you qualify for a partial exclusion, you must determine:

  1. The number of days your home was your primary residence in the five years before the sale.
  2. The number of days you owned your home in the five years before the sale.
  3. The number of days between the last time you claimed an exclusion and the sales date for your home, only if you claimed another exclusion within two years.

Take the smallest of the three numbers, divide by 730 days, round to the third decimal place and multiply by $250,000 to determine your eligible exclusion. For example, if you owned and lived in your home for one year before the sale, divide 365 days by 730 days to get 0.500. Multiply that by $250,000 to determine your allowable exclusion of $125,000.


Income tax regulations are complex and can vary based on individual circumstances. Please consult your tax adviser or contact the Internal Revenue Service if you have questions about calculating your taxable gain from the sale of your home.