Yes. It can be used to offset capital gain from the sale of second home.
For more information check Capital Gains and Losses
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"