Live in your primary residence for at least two of the last five years and you can exclude up to $250,000 of profit from capital gains tax when you sell, or $500,000 for married couples. Keep records of home improvements, which raise your cost basis and shrink the taxable gain. Learn the residency rule before you list, not after.

Source