Please follow
https://www.irs.gov/uac/how-selling-your-home-can-impact-your-taxes
.