Generally, you can claim an itemized deduction on your federal income tax return for mortgage interest on your main home or second home. Your main home is where you live most of the time. Your mortgage interest on your main home would generally be fully deductible.
If you have a second home that you do not hold out for rent at any time during the year, you are not required to have lived in the home in order to deduct the mortgage interest. But if you have a second home that you rent out part of the year, you must also live in it for part of the year in order to deduct the mortgage interest. According to the IRS, you must live in the home more than 14 days or more than 10% of the number of days the home was rented, whichever is longer. Otherwise, the second home would be considered a rental property.
The IRS points out that if you live in a home and rent it out for less than 15 days during the year, you do not have to report the rental income on your tax return and you could not deduct any rental expenses. You could claim the full home mortgage interest deduction as an itemized deduction on Schedule A.
If you rent out part of your home, you may still be able to claim the full home mortgage interest deduction. If the rented part of your home is used primarily for residential living, is not a separate, self-contained unit, and you do not rent to more than two tenants at any time during the year, your home would qualify and you could claim the full home mortgage interest deduction. But if you have a separate apartment in your home, that apartment would generally be considered a rental property.
When you rent out your home you would have to report the rental income on your tax return. You could deduct the mortgage interest as a rent expense. This includes the period when the property is vacant, if you held the property out for rent. Normally you would report your rental income and expenses on Schedule E.
As indicated by the IRS, when you use your home for personal purposes for part of the year; that is, you live in your home, and then you move out and rent the home, you would have to divide up your expenses between the part of the year you lived in the home and the part of the year you rented out the home or held it out for rent.
You would report the portion of the home mortgage interest for the portion of the year you lived in your home, along with qualified mortgage insurance premiums and real estate taxes, as an itemized deduction on Schedule A. The mortgage interest for the portion of the year you rented out your home, plus other rental expenses including depreciation, would be reported on Schedule E.
Publication 527, Residential Rental Property, IRS
Publication 936, Home Mortgage Interest Deduction, IRS
Schedule A, Itemized Deductions
Schedule E, Supplemental Income and Loss