Question: how many years do you have to live in your home before selling?
Answer: To avoid capital gains tax, the home must be your primary residence for two of the five years prior to the sale. To avoid this, the home must be your primary residence that you live in for a minimum of two of the five years prior to the sale.