Question: how long do you have to keep a house before selling it?
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.