Deductions & credits

You must to have lived in the second home for at least 2 out of the last 5 years before you sell it. For married couples filing jointly, both of you must meet the residency requirement to qualify for an exclusion.

 

Here is a TurboTax article about tax aspects of home ownership.