If you used your home as anything other than your primary residence then your gains must be separated between qualifying and non-qualifying use.

Qualifying Use
If you have used your home for your primary residence then you are able to deduct up to $250,000.00 for single filers and $500,000.00 if you are married and filing jointly. You must have used your home for your primary residence for at least two years out of the five years ending on the date that the home is sold. Your real estate will be able to hold on to its qualifying status if there is an absence in the home due to a change in job, health problems, or certain types of unforeseen changes. If any of this sounds uninviting, there is a way to calculate capital gains tax.

Non Qualifying Use
If your home was not used as your primary residence. Any type of short term absence from the home that does not exceed a total of two years will still be considered qualifying use. If you used your home as your primary residence but you did not meet the time test to qualify then you are able to allocate your capital tax gains. This means that the time you lived in your home will be allocated as qualifying use and therefore will become tax deductible.