According to the rules, as long as you have lived in the home for 2 of the past 5 years and owned it, then you can still take advantage of the capital gains exclusion. So even though you have been using the first home as a rental, if from the date of closing, going back 5 years, if you had lived in and owned it as your primary residence, you can still take advantage of the capital gains exclusion.
however a word of caution.
The capital gains formula for a rental home is:
Capital gains (rental) = sell price -(original purchase price, + improvements, + major repairs, + Hud 1 costs not previously taken, - accumulated depreciation) - cost of selling.
so why do you suppose that we take the depreciation out? because the IRS will still take the recapture of accumulated depreciation by assessing a 25% tax on the depreciation.
Isn't it technically less than two years?
what do you mean technically less than two years. It has to be a full 24 months, to the day.
There is an exception if you are required to sell the home for unforeseen circumstances.
Unforeseen circumstances are such things as:
In the unforeseen circumstances situation, then you may take an apportioned amount of the maximum capital gains exclusion. this is called a reduced capital gains exclusion.
There is no roll over of the primary home.
If you roll the firs home into a new rental unit, you can defer capital gains by what is called a like kind exchange. To be a like kind exchange you have to have designated the exchange prior to closing, and you have to use an exchange agent. You have only six months form the sale to complete the exchange.
The catch 22 is, you can not like kind exchange a primary residence.
AND you do not technically avoid capital gains tax, you defer it to another day in the future.