Deductions & credits

Any capital gains on the investment home are subject to capital gains tax.

 

Any capital gains on your main residence are subject to capital gains tax unless you qualify for the special exclusion.  If you qualify, you can exclude up to the first $250,000 of gain (or $500,000 if married filing jointly).  You must have owned the home at least 2 years, and lived in the home as your main home for at least 2 of the past 5 years (730 or more days, they do not have to be consecutive).  If the reason you are moving has to do with a unforeseen financial hardship as explained in publication 523, you may qualify for a partial exclusion.  If not, you owe the capital gains tax.  Review publication 523 here.

https://www.irs.gov/pub/irs-pdf/p523.pdf